Overview
Comment: | Nicer output for OFList tests. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0425fb0d0bfd856390ce6e2b3e235e32 |
User & Date: | js on 2008-12-13 22:09:25 |
Other Links: | manifest | tags |
Context
2008-12-13
| ||
22:16 | Properly clear line in tests on failure. check-in: 81c57d9f39 user: js tags: trunk | |
22:09 | Nicer output for OFList tests. check-in: 0425fb0d0b user: js tags: trunk | |
21:55 | Nicer output for OFXMLFactory tests. check-in: c2e0027c47 user: js tags: trunk | |
Changes
Modified tests/OFList/OFList.m from [ee2d05fa09] to [bb00b9248d].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #define _ISOC99_SOURCE #import <string.h> #import <wchar.h> #import "OFString.h" #import "OFList.h" const wchar_t *strings[] = { L"First String Object", L"Second String Object", L"Third String Object" }; | > > > > > > > > > > > > > > > > > > > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #define _ISOC99_SOURCE #import <string.h> #import <wchar.h> #import "OFString.h" #import "OFList.h" #define NUM_TESTS 5 #define SUCCESS \ { \ wprintf(L"\r\033[1;%dmTests successful: %d/%d\033[0m", \ (i == NUM_TESTS - 1 ? 32 : 33), i + 1, NUM_TESTS); \ fflush(stdout); \ } #define FAIL \ { \ wprintf(L"\r\033[1;31mTest %d/%d failed!\033[m\n", \ i + 1, NUM_TESTS); \ return 1; \ } #define CHECK(cond) \ if (cond) \ SUCCESS \ else \ FAIL \ i++; const wchar_t *strings[] = { L"First String Object", L"Second String Object", L"Third String Object" }; |
︙ | ︙ | |||
36 37 38 39 40 41 42 | [list addNew: [OFString newFromWideCString: strings[0]]]; [list addNew: [OFString newFromWideCString: strings[1]]]; [list addNew: [OFString newFromWideCString: strings[2]]]; for (iter = [list first], i = 0; iter != nil; iter = [iter next], i++) if (!wcscmp([(OFString*)[iter data] wideCString], strings[i])) | | | < < > | < | < < < < < < | < < < < | > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | [list addNew: [OFString newFromWideCString: strings[0]]]; [list addNew: [OFString newFromWideCString: strings[1]]]; [list addNew: [OFString newFromWideCString: strings[2]]]; for (iter = [list first], i = 0; iter != nil; iter = [iter next], i++) if (!wcscmp([(OFString*)[iter data] wideCString], strings[i])) SUCCESS else FAIL CHECK(!wcscmp([(OFString*)[[list first] data] wideCString], strings[0])) CHECK(!wcscmp([(OFString*)[[list last] data] wideCString], strings[2])) wprintf(L"\n"); [list freeIncludingData]; return 0; } |