Commits

Alexey Kishkin committed 69c8559

add set_int32 test

Comments (0)

Files changed (1)

        assert_equal "\000\001\000\000" (let cargo = Buffer.create 4 in (set_i32 cargo 0x10000; Buffer.contents cargo));
        assert_equal "\000\255\255\255" (let cargo = Buffer.create 4 in (set_i32 cargo 0xFFFFFF; Buffer.contents cargo));
        assert_equal "\001\000\000\000" (let cargo = Buffer.create 4 in (set_i32 cargo 0x1000000; Buffer.contents cargo));
+      );
+   "set_int32" >:: (fun() ->  
+       assert_equal "\000\000\000\000" (let cargo = Buffer.create 4 in (set_int32 cargo 0l; Buffer.contents cargo)); 
+       assert_equal "\000\000\000\010" (let cargo = Buffer.create 4 in (set_int32 cargo 10l; Buffer.contents cargo)); 
+       assert_equal "\000\000\000\255" (let cargo = Buffer.create 4 in (set_int32 cargo 255l; Buffer.contents cargo));
+       assert_equal "\000\000\001\000" (let cargo = Buffer.create 4 in (set_int32 cargo 256l; Buffer.contents cargo));
+       assert_equal "\000\000\255\255" (let cargo = Buffer.create 4 in (set_int32 cargo 0xFFFFl; Buffer.contents cargo));
+       assert_equal "\000\001\000\000" (let cargo = Buffer.create 4 in (set_int32 cargo 0x10000l; Buffer.contents cargo));
+       assert_equal "\000\255\255\255" (let cargo = Buffer.create 4 in (set_int32 cargo 0xFFFFFFl; Buffer.contents cargo));
+       assert_equal "\001\000\000\000" (let cargo = Buffer.create 4 in (set_int32 cargo 0x1000000l; Buffer.contents cargo));
       )
    ];;