test for difference in hash code for the same binary representation for different types. The value boolean "true" and the integer value "1" have the same binary representation. Given that, their types are different, so this test makes sure that their hash code is different
| 214 | // have the same binary representation. Given that, their types are different, |
| 215 | // so this test makes sure that their hash code is different |
| 216 | void test_hashLongAndBool() { |
| 217 | SIValue siInt64 = SI_LongVal(1); |
| 218 | SIValue siBool = SI_BoolVal(true); |
| 219 | uint64_t longHashCode = SIValue_HashCode(siInt64); |
| 220 | uint64_t boolHashCode = SIValue_HashCode(siBool); |
| 221 | TEST_ASSERT(longHashCode != boolHashCode); |
| 222 | |
| 223 | siInt64 = SI_LongVal(0); |
| 224 | siBool = SI_BoolVal(false); |
| 225 | |
| 226 | longHashCode = SIValue_HashCode(siInt64); |
| 227 | boolHashCode = SIValue_HashCode(siBool); |
| 228 | TEST_ASSERT(longHashCode != boolHashCode); |
| 229 | } |
| 230 | |
| 231 | // Test for the same hash code for same semantic value. |
| 232 | void test_hashLongAndDouble() { |
nothing calls this directly
no test coverage detected