Changeset 5781 in vbox for trunk/src/VBox/Runtime/testcase/tstStrToNum.cpp
- Timestamp:
- Nov 16, 2007 6:55:05 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstStrToNum.cpp
r4071 r5781 53 53 54 54 55 #define TEST(Test, Type, Fmt, Fun ) \55 #define TEST(Test, Type, Fmt, Fun, iTest) \ 56 56 do \ 57 57 { \ … … 60 60 if (Result != Test.Result) \ 61 61 { \ 62 RTPrintf("failure: '%s' -> " Fmt " expected " Fmt ". (%s )\n", Test.psz, Result, Test.Result, #Fun); \62 RTPrintf("failure: '%s' -> " Fmt " expected " Fmt ". (%s/%u)\n", Test.psz, Result, Test.Result, #Fun, iTest); \ 63 63 cErrors++; \ 64 64 } \ 65 65 else if (rc != Test.rc) \ 66 66 { \ 67 RTPrintf("failure: '%s' -> rc=%Vrc expected %Vrc. (%s )\n", Test.psz, rc, Test.rc, #Fun); \67 RTPrintf("failure: '%s' -> rc=%Vrc expected %Vrc. (%s/%u)\n", Test.psz, rc, Test.rc, #Fun, iTest); \ 68 68 cErrors++; \ 69 69 } \ … … 76 76 for (unsigned iTest = 0; iTest < ELEMENTS(aTests); iTest++) \ 77 77 { \ 78 TEST(aTests[iTest], Type, Fmt, Fun ); \78 TEST(aTests[iTest], Type, Fmt, Fun, iTest); \ 79 79 } \ 80 80 } while (0) … … 88 88 { "1", 0, VINF_SUCCESS, 1 }, 89 89 { "-1", 0, VWRN_NEGATIVE_UNSIGNED, ~0ULL }, 90 { "0x", 0, V INF_SUCCESS,0 },90 { "0x", 0, VWRN_TRAILING_CHARS, 0 }, 91 91 { "0x1", 0, VINF_SUCCESS, 1 }, 92 92 { "0x0fffffffffffffff", 0, VINF_SUCCESS, 0x0fffffffffffffffULL }, … … 94 94 { "asdfasdfasdf", 0, VERR_NO_DIGITS, 0 }, 95 95 { "0x111111111", 0, VINF_SUCCESS, 0x111111111ULL }, 96 { "4D9702C5CBD9B778", 16, VINF_SUCCESS, UINT64_C(0x4D9702C5CBD9B778) }, 96 97 }; 97 98 RUN_TESTS(aTstU64, uint64_t, "%#llx", RTStrToUInt64Ex); … … 126 127 { "-1234567890123456789", 0, VINF_SUCCESS, -1234567890123456789LL }, 127 128 { "-1234567890123456789", 10, VINF_SUCCESS, -1234567890123456789LL }, 128 { "0x", 0, V INF_SUCCESS,0 },129 { "0x1", 0, VINF_SUCCESS, 1 }, 130 { "0x1", 10, V INF_SUCCESS,0 },129 { "0x", 0, VWRN_TRAILING_CHARS, 0 }, 130 { "0x1", 0, VINF_SUCCESS, 1 }, 131 { "0x1", 10, VWRN_TRAILING_CHARS, 0 }, 131 132 { "0x1", 16, VINF_SUCCESS, 1 }, 132 133 { "0x0fffffffffffffff", 0, VINF_SUCCESS, 0x0fffffffffffffffULL }, 133 //{ "0x01111111111111111111111",0, VWRN_NUMBER_TOO_BIG, 0x1111111111111111ULL }, 134 { "0x7fffffffffffffff", 0, VINF_SUCCESS, 0x7fffffffffffffffULL }, 135 { "0xffffffffffffffff", 0, VWRN_NUMBER_TOO_BIG, -1 }, 136 { "0x01111111111111111111111",0, VWRN_NUMBER_TOO_BIG, 0x1111111111111111ULL }, 137 { "0x02222222222222222222222",0, VWRN_NUMBER_TOO_BIG, 0x2222222222222222ULL }, 138 { "0x03333333333333333333333",0, VWRN_NUMBER_TOO_BIG, 0x3333333333333333ULL }, 139 { "0x04444444444444444444444",0, VWRN_NUMBER_TOO_BIG, 0x4444444444444444ULL }, 140 { "0x07777777777777777777777",0, VWRN_NUMBER_TOO_BIG, 0x7777777777777777ULL }, 141 { "0x07f7f7f7f7f7f7f7f7f7f7f",0, VWRN_NUMBER_TOO_BIG, 0x7f7f7f7f7f7f7f7fULL }, 134 142 { "0x0ffffffffffffffffffffff",0, VWRN_NUMBER_TOO_BIG, 0xffffffffffffffffULL }, 135 143 { "asdfasdfasdf", 0, VERR_NO_DIGITS, 0 }, … … 173 181 { "1234567890123456789", 0, VWRN_NUMBER_TOO_BIG, (int32_t)1234567890123456789LL }, 174 182 { "1234567890123456789", 10, VWRN_NUMBER_TOO_BIG, (int32_t)1234567890123456789LL }, 175 { "0x", 0, V INF_SUCCESS,0 },176 { "0x1", 0, VINF_SUCCESS, 1 }, 177 { "0x1", 10, V INF_SUCCESS,0 },183 { "0x", 0, VWRN_TRAILING_CHARS, 0 }, 184 { "0x1", 0, VINF_SUCCESS, 1 }, 185 { "0x1", 10, VWRN_TRAILING_CHARS, 0 }, 178 186 { "0x1", 16, VINF_SUCCESS, 1 }, 179 { "0x0fffffffffffffff", 0, VWRN_NUMBER_TOO_BIG, 0xffffffff }, 187 { "0x7fffffff", 0, VINF_SUCCESS, 0x7fffffff }, 188 { "0x80000000", 0, VWRN_NUMBER_TOO_BIG, INT32_MIN }, 189 { "0xffffffff", 0, VWRN_NUMBER_TOO_BIG, -1 }, 190 { "0x0fffffffffffffff", 0, VWRN_NUMBER_TOO_BIG, 0xffffffff }, 180 191 { "0x01111111111111111111111",0, VWRN_NUMBER_TOO_BIG, 0x11111111 }, 181 192 { "0x0ffffffffffffffffffffff",0, VWRN_NUMBER_TOO_BIG, 0xffffffff }, … … 190 201 { "1", 0, VINF_SUCCESS, 1 }, 191 202 { "-1", 0, VWRN_NEGATIVE_UNSIGNED, ~0 }, 192 { "0x", 0, V INF_SUCCESS,0 },203 { "0x", 0, VWRN_TRAILING_CHARS, 0 }, 193 204 { "0x1", 0, VINF_SUCCESS, 1 }, 194 205 { "0x0fffffffffffffff", 0, VWRN_NUMBER_TOO_BIG, 0xffffffffU },
Note:
See TracChangeset
for help on using the changeset viewer.