Changeset 50418 in vbox for trunk/src/VBox/Runtime/testcase
- Timestamp:
- Feb 11, 2014 6:50:58 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstRTNetIPv4.cpp
r50415 r50418 66 66 67 67 68 #define CHECKADDREX(String, Trailer, rcExpected, ExpectedAddr) \ 69 do { \ 70 RTNETADDRIPV4 Addr; \ 71 const char *strAll = String /* concat */ Trailer; \ 72 const char *pTrailer = strAll + sizeof(String) - 1; \ 73 char *pNext = NULL; \ 74 int rc2 = RTNetStrToIPv4AddrEx(strAll, &Addr, &pNext); \ 75 if ((rcExpected) && !rc2) \ 76 { \ 77 RTTestIFailed("at line %d: '%s': expected %Rrc got %Rrc\n", \ 78 __LINE__, String, (rcExpected), rc2); \ 79 } \ 80 else if ((rcExpected) != rc2 \ 81 || (rc2 == VINF_SUCCESS \ 82 && (RT_H2N_U32_C(ExpectedAddr) != Addr.u \ 83 || pTrailer != pNext))) \ 84 { \ 85 RTTestIFailed("at line %d: '%s': expected %Rrc got %Rrc," \ 86 " expected address %RTnaipv4 got %RTnaipv4" \ 87 " expected trailer \"%s\" got %s%s%s" \ 88 "\n", \ 89 __LINE__, String, rcExpected, rc2, \ 90 RT_H2N_U32_C(ExpectedAddr), Addr.u, \ 91 pTrailer, \ 92 pNext ? "\"" : "", \ 93 pNext ? pNext : "(null)", \ 94 pNext ? "\"" : ""); \ 95 } \ 96 } while (0) 97 98 68 99 int main() 69 100 { … … 91 122 BADADDR("1.2.3.666"); 92 123 124 /* 125 * Parsing itself is covered by the tests above, here we only 126 * check trailers 127 */ 128 CHECKADDREX("1.2.3.4", "", VINF_SUCCESS, 0x01020304); 129 CHECKADDREX("1.2.3.4", " ", VINF_SUCCESS, 0x01020304); 130 CHECKADDREX("1.2.3.4", "x", VINF_SUCCESS, 0x01020304); 131 CHECKADDREX("1.2.3.444", "", VERR_INVALID_PARAMETER, 0); 132 93 133 return RTTestSummaryAndDestroy(hTest); 94 134 }
Note:
See TracChangeset
for help on using the changeset viewer.