Fixed overflow warning in unit test on 32-bit compile
parent
2553e39746
commit
2d14896497
|
@ -36,28 +36,33 @@ TEST(Key, KeySymbolConversion) {
|
|||
EXPECT(assert_equal(original, actual))
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<int KeySize>
|
||||
Key KeyTestValue();
|
||||
|
||||
template<>
|
||||
Key KeyTestValue<8>()
|
||||
{
|
||||
return 0x6100000000000005;
|
||||
};
|
||||
|
||||
template<>
|
||||
Key KeyTestValue<4>()
|
||||
{
|
||||
return 0x61000005;
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST(Key, KeySymbolEncoding) {
|
||||
|
||||
// Test encoding of Symbol <-> size_t <-> string
|
||||
|
||||
if(sizeof(Key) == 8) {
|
||||
Symbol symbol(0x61, 5);
|
||||
Key key = 0x6100000000000005;
|
||||
Key key = KeyTestValue<sizeof(Key)>();
|
||||
string str = "a5";
|
||||
|
||||
EXPECT_LONGS_EQUAL((long)key, (long)(Key)symbol);
|
||||
EXPECT(assert_equal(str, DefaultKeyFormatter(symbol)));
|
||||
EXPECT(assert_equal(symbol, Symbol(key)));
|
||||
} else if(sizeof(Key) == 4) {
|
||||
Symbol symbol(0x61, 5);
|
||||
Key key = 0x61000005;
|
||||
string str = "a5";
|
||||
|
||||
EXPECT_LONGS_EQUAL((long)key, (long)(Key)symbol);
|
||||
EXPECT(assert_equal(str, DefaultKeyFormatter(symbol)));
|
||||
EXPECT(assert_equal(symbol, Symbol(key)));
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
Loading…
Reference in New Issue