Rename & reorder readed bytes arg in string funcs
This commit is contained in:
@@ -8,35 +8,35 @@ BH_UNIT_TEST(Int8)
|
||||
size_t size;
|
||||
|
||||
BH_VERIFY(BH_StringFromInt8s(str, 9, -13, 16, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt8s(str, &size, 16) == -13);
|
||||
BH_VERIFY(BH_StringToInt8s(str, 16, &size) == -13);
|
||||
BH_VERIFY(size == 2);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt8s(str, 9, -13, 10, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt8s(str, &size, 10) == -13);
|
||||
BH_VERIFY(BH_StringToInt8s(str, 10, &size) == -13);
|
||||
BH_VERIFY(size == 3);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt8s(str, 9, -13, 8, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt8s(str, &size, 8) == -13);
|
||||
BH_VERIFY(BH_StringToInt8s(str, 8, &size) == -13);
|
||||
BH_VERIFY(size == 3);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt8s(str, 9, -13, 2, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt8s(str, &size, 2) == -13);
|
||||
BH_VERIFY(BH_StringToInt8s(str, 2, &size) == -13);
|
||||
BH_VERIFY(size == 5);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt8u(str, 9, 200, 16, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt8u(str, &size, 16) == 200);
|
||||
BH_VERIFY(BH_StringToInt8u(str, 16, &size) == 200);
|
||||
BH_VERIFY(size == 2);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt8u(str, 9, 200, 10, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt8u(str, &size, 10) == 200);
|
||||
BH_VERIFY(BH_StringToInt8u(str, 10, &size) == 200);
|
||||
BH_VERIFY(size == 3);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt8u(str, 9, 200, 8, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt8u(str, &size, 8) == 200);
|
||||
BH_VERIFY(BH_StringToInt8u(str, 8, &size) == 200);
|
||||
BH_VERIFY(size == 3);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt8u(str, 9, 200, 2, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt8u(str, &size, 2) == 200);
|
||||
BH_VERIFY(BH_StringToInt8u(str, 2, &size) == 200);
|
||||
BH_VERIFY(size == 8);
|
||||
|
||||
return 0;
|
||||
@@ -49,35 +49,35 @@ BH_UNIT_TEST(Int16)
|
||||
size_t size;
|
||||
|
||||
BH_VERIFY(BH_StringFromInt16s(str, 17, -1234, 16, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt16s(str, &size, 16) == -1234);
|
||||
BH_VERIFY(BH_StringToInt16s(str, 16, &size) == -1234);
|
||||
BH_VERIFY(size == 4);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt16s(str, 17, -1234, 10, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt16s(str, &size, 10) == -1234);
|
||||
BH_VERIFY(BH_StringToInt16s(str, 10, &size) == -1234);
|
||||
BH_VERIFY(size == 5);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt16s(str, 17, -1234, 8, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt16s(str, &size, 8) == -1234);
|
||||
BH_VERIFY(BH_StringToInt16s(str, 8, &size) == -1234);
|
||||
BH_VERIFY(size == 5);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt16s(str, 17, -1234, 2, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt16s(str, &size, 2) == -1234);
|
||||
BH_VERIFY(BH_StringToInt16s(str, 2, &size) == -1234);
|
||||
BH_VERIFY(size == 12);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt16u(str, 17, 43210, 16, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt16u(str, &size, 16) == 43210);
|
||||
BH_VERIFY(BH_StringToInt16u(str, 16, &size) == 43210);
|
||||
BH_VERIFY(size == 4);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt16u(str, 17, 43210, 10, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt16u(str, &size, 10) == 43210);
|
||||
BH_VERIFY(BH_StringToInt16u(str, 10, &size) == 43210);
|
||||
BH_VERIFY(size == 5);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt16u(str, 17, 43210, 8, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt16u(str, &size, 8) == 43210);
|
||||
BH_VERIFY(BH_StringToInt16u(str, 8, &size) == 43210);
|
||||
BH_VERIFY(size == 6);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt16u(str, 17, 43210, 2, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt16u(str, &size, 2) == 43210);
|
||||
BH_VERIFY(BH_StringToInt16u(str, 2, &size) == 43210);
|
||||
BH_VERIFY(size == 16);
|
||||
|
||||
return 0;
|
||||
@@ -90,35 +90,35 @@ BH_UNIT_TEST(Int32)
|
||||
size_t size;
|
||||
|
||||
BH_VERIFY(BH_StringFromInt32s(str, 33, -1234567890l, 16, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt32s(str, &size, 16) == -1234567890l);
|
||||
BH_VERIFY(BH_StringToInt32s(str, 16, &size) == -1234567890l);
|
||||
BH_VERIFY(size == 9);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt32s(str, 33, -1234567890l, 10, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt32s(str, &size, 10) == -1234567890l);
|
||||
BH_VERIFY(BH_StringToInt32s(str, 10, &size) == -1234567890l);
|
||||
BH_VERIFY(size == 11);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt32s(str, 33, -1234567890l, 8, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt32s(str, &size, 8) == -1234567890l);
|
||||
BH_VERIFY(BH_StringToInt32s(str, 8, &size) == -1234567890l);
|
||||
BH_VERIFY(size == 12);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt32s(str, 33, -1234567890l, 2, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt32s(str, &size, 2) == -1234567890l);
|
||||
BH_VERIFY(BH_StringToInt32s(str, 2, &size) == -1234567890l);
|
||||
BH_VERIFY(size == 32);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt32u(str, 33, 3456789012ul, 16, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt32u(str, &size, 16) == 3456789012ul);
|
||||
BH_VERIFY(BH_StringToInt32u(str, 16, &size) == 3456789012ul);
|
||||
BH_VERIFY(size == 8);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt32u(str, 33, 3456789012ul, 10, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt32u(str, &size, 10) == 3456789012ul);
|
||||
BH_VERIFY(BH_StringToInt32u(str, 10, &size) == 3456789012ul);
|
||||
BH_VERIFY(size == 10);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt32u(str, 33, 3456789012ul, 8, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt32u(str, &size, 8) == 3456789012ul);
|
||||
BH_VERIFY(BH_StringToInt32u(str, 8, &size) == 3456789012ul);
|
||||
BH_VERIFY(size == 11);
|
||||
|
||||
BH_VERIFY(BH_StringFromInt32u(str, 33, 3456789012ul, 2, NULL) == BH_OK);
|
||||
BH_VERIFY(BH_StringToInt32u(str, &size, 2) == 3456789012ul);
|
||||
BH_VERIFY(BH_StringToInt32u(str, 2, &size) == 3456789012ul);
|
||||
BH_VERIFY(size == 32);
|
||||
|
||||
return 0;
|
||||
@@ -129,34 +129,34 @@ BH_UNIT_TEST(Parsing)
|
||||
{
|
||||
size_t size;
|
||||
|
||||
BH_VERIFY(BH_StringToInt32s(" 0x1234", &size, 16) == 0x1234);
|
||||
BH_VERIFY(BH_StringToInt32s(" 0x1234", 16, &size) == 0x1234);
|
||||
BH_VERIFY(size == 9);
|
||||
|
||||
BH_VERIFY(BH_StringToInt32s(" 12345", &size, 10) == 12345);
|
||||
BH_VERIFY(BH_StringToInt32s(" 12345", 10, &size) == 12345);
|
||||
BH_VERIFY(size == 8);
|
||||
|
||||
BH_VERIFY(BH_StringToInt32s(" 0123", &size, 8) == 0123);
|
||||
BH_VERIFY(BH_StringToInt32s(" 0123", 8, &size) == 0123);
|
||||
BH_VERIFY(size == 7);
|
||||
|
||||
BH_VERIFY(BH_StringToInt32s(" 0b1111Hello", &size, 2) == 15);
|
||||
BH_VERIFY(BH_StringToInt32s(" 0b1111Hello", 2, &size) == 15);
|
||||
BH_VERIFY(size == 9);
|
||||
|
||||
BH_VERIFY(BH_StringToInt32s(" 0x1234", &size, 0) == 0x1234);
|
||||
BH_VERIFY(BH_StringToInt32s(" 0x1234", 0, &size) == 0x1234);
|
||||
BH_VERIFY(size == 9);
|
||||
|
||||
BH_VERIFY(BH_StringToInt32s(" 0123", &size, 0) == 0123);
|
||||
BH_VERIFY(BH_StringToInt32s(" 0123", 0, &size) == 0123);
|
||||
BH_VERIFY(size == 7);
|
||||
|
||||
BH_VERIFY(BH_StringToInt32s(" 123", &size, 0) == 123);
|
||||
BH_VERIFY(BH_StringToInt32s(" 123", 0, &size) == 123);
|
||||
BH_VERIFY(size == 6);
|
||||
|
||||
BH_VERIFY(BH_StringToInt32s(" 0b1111", &size, 0) == 15);
|
||||
BH_VERIFY(BH_StringToInt32s(" 0b1111", 0, &size) == 15);
|
||||
BH_VERIFY(size == 9);
|
||||
|
||||
BH_VERIFY(BH_StringToInt32s(" 12345Hello", &size, 10) == 12345);
|
||||
BH_VERIFY(BH_StringToInt32s(" 12345Hello", 10, &size) == 12345);
|
||||
BH_VERIFY(size == 8);
|
||||
|
||||
BH_VERIFY(BH_StringToInt32s(" Hello", &size, 10) == 0);
|
||||
BH_VERIFY(BH_StringToInt32s(" Hello", 10, &size) == 0);
|
||||
BH_VERIFY(size == 0);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user