MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / test_hashLongAndBool

Function test_hashLongAndBool

tests/unit/test_value.c:216–229  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

214// have the same binary representation. Given that, their types are different,
215// so this test makes sure that their hash code is different
216void 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.
232void test_hashLongAndDouble() {

Callers

nothing calls this directly

Calls 3

SI_LongValFunction · 0.85
SI_BoolValFunction · 0.85
SIValue_HashCodeFunction · 0.85

Tested by

no test coverage detected