]> granicus.if.org Git - postgis/commitdiff
Add a couple more tests for varint encoding
authorSandro Santilli <strk@keybit.net>
Thu, 31 Jul 2014 08:42:03 +0000 (08:42 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 31 Jul 2014 08:42:03 +0000 (08:42 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@12846 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_varint.c

index 993015a16daf9e412ab9e480e5364a093d4d8401..ab8cf6fc7a476aa0a725c7a5813417fe9ab56e13 100644 (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
+   */
+
 
 }