Use the “identical to” operator ===:
if b === Test.self {
print("yes")
}
else {
print("no")
}
This works because the type of a class is itself a class object and can therefore
be compared with ===.
It won’t work with structs. Perhaps someone has a better answer that works for
all Swift types.