|
7 | 7 |
|
8 | 8 | public void OnPluginStart() |
9 | 9 | { |
10 | | - Test_StringToInt64Ex(); |
| 10 | + Test_StringToI64(); |
11 | 11 | } |
12 | 12 |
|
13 | 13 |
|
14 | | -void Test_StringToInt64Ex() |
| 14 | +void Test_StringToI64() |
15 | 15 | { |
16 | | - SetTestContext("Test StringToInt64Ex"); |
| 16 | + SetTestContext("Test StringToI64"); |
17 | 17 |
|
18 | | - AssertInt64Eq("DEC 0", StringToInt64Ex("0"), 0); |
19 | | - AssertInt64Eq("DEC 1234567", StringToInt64Ex("1234567"), 1234567); |
20 | | - AssertInt64Eq("DEC 1234567654321", StringToInt64Ex("1234567654321"), 1234567654321); |
21 | | - AssertInt64Eq("DEC 9223372036854775807", StringToInt64Ex("9223372036854775807"), 9223372036854775807); |
22 | | - AssertInt64Eq("DEC -1234567", StringToInt64Ex("-1234567"), -1234567); |
23 | | - AssertInt64Eq("DEC -1234567654321", StringToInt64Ex("-1234567654321"), -1234567654321); |
24 | | - AssertInt64Eq("DEC -9223372036854775807", StringToInt64Ex("-9223372036854775807"), -9223372036854775807); |
| 18 | + AssertInt64Eq("DEC 0", StringToI64("0"), 0); |
| 19 | + AssertInt64Eq("DEC 1234567", StringToI64("1234567"), 1234567); |
| 20 | + AssertInt64Eq("DEC 1234567654321", StringToI64("1234567654321"), 1234567654321); |
| 21 | + AssertInt64Eq("DEC 9223372036854775807", StringToI64("9223372036854775807"), 9223372036854775807); |
| 22 | + AssertInt64Eq("DEC -1234567", StringToI64("-1234567"), -1234567); |
| 23 | + AssertInt64Eq("DEC -1234567654321", StringToI64("-1234567654321"), -1234567654321); |
| 24 | + AssertInt64Eq("DEC -9223372036854775807", StringToI64("-9223372036854775807"), -9223372036854775807); |
25 | 25 |
|
26 | | - int bytes; |
| 26 | + int nConsumed; |
27 | 27 |
|
28 | | - // bytes |
| 28 | + // nConsumed |
29 | 29 | AssertInt64Eq( |
30 | | - "result 0", |
31 | | - StringToInt64Ex("0", bytes), |
| 30 | + "result 0", |
| 31 | + StringToI64("0", .nConsumed=nConsumed), |
32 | 32 | 0); |
33 | | - AssertEq("bytes 0", bytes, 1); |
| 33 | + AssertEq("nConsumed 0", nConsumed, 1); |
34 | 34 |
|
35 | 35 | AssertInt64Eq( |
36 | | - "result 1234567", |
37 | | - StringToInt64Ex("1234567", bytes), |
| 36 | + "result 1234567", |
| 37 | + StringToI64("1234567", .nConsumed=nConsumed), |
38 | 38 | 1234567); |
39 | | - AssertEq("bytes 1234567", bytes, 7); |
| 39 | + AssertEq("nConsumed 1234567", nConsumed, 7); |
40 | 40 |
|
41 | 41 | AssertInt64Eq( |
42 | | - "result 1234567654321", |
43 | | - StringToInt64Ex("1234567654321", bytes), |
| 42 | + "result 1234567654321", |
| 43 | + StringToI64("1234567654321", .nConsumed=nConsumed), |
44 | 44 | 1234567654321); |
45 | | - AssertEq("bytes 1234567654321", bytes, 13); |
| 45 | + AssertEq("nConsumed 1234567654321", nConsumed, 13); |
46 | 46 |
|
47 | 47 | AssertInt64Eq( |
48 | | - "result 9223372036854775807", |
49 | | - StringToInt64Ex("9223372036854775807", bytes), |
| 48 | + "result 9223372036854775807", |
| 49 | + StringToI64("9223372036854775807", .nConsumed=nConsumed), |
50 | 50 | 9223372036854775807); |
51 | | - AssertEq("bytes 9223372036854775807", bytes, 19); |
| 51 | + AssertEq("nConsumed 9223372036854775807", nConsumed, 19); |
52 | 52 |
|
53 | 53 | AssertInt64Eq( |
54 | | - "result -1234567", |
55 | | - StringToInt64Ex("-1234567", bytes), |
| 54 | + "result -1234567", |
| 55 | + StringToI64("-1234567", .nConsumed=nConsumed), |
56 | 56 | -1234567); |
57 | | - AssertEq("bytes -1234567", bytes, 8); |
| 57 | + AssertEq("nConsumed -1234567", nConsumed, 8); |
58 | 58 |
|
59 | 59 | AssertInt64Eq( |
60 | | - "result -1234567654321", |
61 | | - StringToInt64Ex("-1234567654321", bytes), |
| 60 | + "result -1234567654321", |
| 61 | + StringToI64("-1234567654321", .nConsumed=nConsumed), |
62 | 62 | -1234567654321); |
63 | | - AssertEq("bytes -1234567654321", bytes, 14); |
| 63 | + AssertEq("nConsumed -1234567654321", nConsumed, 14); |
64 | 64 |
|
65 | 65 | AssertInt64Eq( |
66 | | - "result -9223372036854775807", |
67 | | - StringToInt64Ex("-9223372036854775807", bytes), |
| 66 | + "result -9223372036854775807", |
| 67 | + StringToI64("-9223372036854775807", .nConsumed=nConsumed), |
68 | 68 | -9223372036854775807); |
69 | | - AssertEq("bytes -9223372036854775807", bytes, 20); |
| 69 | + AssertEq("nConsumed -9223372036854775807", nConsumed, 20); |
70 | 70 |
|
71 | 71 | // Special nBase |
72 | 72 | AssertInt64Eq( |
73 | | - "result 10001111101110001111101110110101110110001", |
74 | | - StringToInt64Ex("10001111101110001111101110110101110110001", bytes, 2), |
| 73 | + "result 10001111101110001111101110110101110110001", |
| 74 | + StringToI64("10001111101110001111101110110101110110001", 2, nConsumed), |
75 | 75 | 1234567654321); |
76 | | - AssertEq("bytes 10001111101110001111101110110101110110001", bytes, 41); |
| 76 | + AssertEq("nConsumed 10001111101110001111101110110101110110001", nConsumed, 41); |
77 | 77 |
|
78 | 78 | AssertInt64Eq( |
79 | | - "result 21756175665661", |
80 | | - StringToInt64Ex("21756175665661", bytes, 8), |
| 79 | + "result 21756175665661", |
| 80 | + StringToI64("21756175665661", 8, nConsumed), |
81 | 81 | 1234567654321); |
82 | | - AssertEq("bytes 11F71F76BB1", bytes, 14); |
| 82 | + AssertEq("nConsumed 21756175665661", nConsumed, 14); |
83 | 83 |
|
84 | 84 | AssertInt64Eq( |
85 | | - "result 11F71F76BB1", |
86 | | - StringToInt64Ex("11F71F76BB1", bytes, 16), |
| 85 | + "result 11F71F76BB1", |
| 86 | + StringToI64("11F71F76BB1", 16, nConsumed), |
87 | 87 | 1234567654321); |
88 | | - AssertEq("bytes 11F71F76BB1", bytes, 11); |
| 88 | + AssertEq("nConsumed 11F71F76BB1", nConsumed, 11); |
89 | 89 |
|
90 | | - // Orther |
| 90 | + // Other |
91 | 91 | AssertInt64Eq( |
92 | | - "result a1b2c3d4e5f6g7", |
93 | | - StringToInt64Ex("a1b2c3d4e5f6g7", bytes), |
| 92 | + "result a1b2c3d4e5f6g7", |
| 93 | + StringToI64("a1b2c3d4e5f6g7", .nConsumed=nConsumed), |
94 | 94 | 0); |
95 | | - AssertEq("bytes a1b2c3d4e5f6g7", bytes, 0); |
| 95 | + AssertEq("nConsumed a1b2c3d4e5f6g7", nConsumed, 0); |
96 | 96 |
|
97 | 97 | AssertInt64Eq( |
98 | | - "result 0b10101", |
99 | | - StringToInt64Ex("0b10101", bytes), |
| 98 | + "result 0b10101", |
| 99 | + StringToI64("0b10101", .nConsumed=nConsumed), |
100 | 100 | 0); |
101 | | - AssertEq("bytes 0b10101", bytes, 1); |
| 101 | + AssertEq("nConsumed 0b10101", nConsumed, 1); |
102 | 102 |
|
103 | 103 | AssertInt64Eq( |
104 | | - "result 1_234_567", |
105 | | - StringToInt64Ex("1_234_567", bytes), |
| 104 | + "result 1_234_567", |
| 105 | + StringToI64("1_234_567", .nConsumed=nConsumed), |
106 | 106 | 1); |
107 | | - AssertEq("bytes 1_234_567", bytes, 1); |
| 107 | + AssertEq("nConsumed 1_234_567", nConsumed, 1); |
108 | 108 | } |
0 commit comments