Add a couple more tests for varint encoding

git-svn-id: http://svn.osgeo.org/postgis/trunk@12846 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2014-07-31 08:42:03 +00:00
parent 06a29523af
commit db90f9670c

View file

@ -155,6 +155,22 @@ static void test_varint(void)
*/
do_test_s32_varint(-2147483648, 5, "FFFFFFFF0F");
do_test_s32_varint(1, 1, "02");
/*
0000:0001 - input (01)
0000:0010 - A: input << 1
0000:0000 - B: input >> 31
0000:0010 - zigzag (A xor B) == output
*/
do_test_s32_varint(-1, 1, "01");
/*
1111:1111 ... 1111:1111 - input (FFFFFFFF)
1111:1111 ... 1111:1110 - A: input << 1
1111:1111 ... 1111:1111 - B: input >> 31
0000:0000 ... 0000:0001 - zigzag (A xor B) == output
*/
}