ObjFW  Check-in [c2e0027c47]

Overview
Comment:Nicer output for OFXMLFactory tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c2e0027c47dc44f1fdc19a32c0ceb2df96649dece49b6810d72af8f21d179087
User & Date: js on 2008-12-13 21:55:39
Other Links: manifest | tags
Context
2008-12-13
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
21:34
Always delete temp symlinks, even if test fails. Plus one new test. check-in: 15ddecd17d user: js tags: trunk
Changes

Modified tests/OFXMLFactory/OFXMLFactory.m from [9182c852bf] to [28e322229e].

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
48
49
50

#import <stdlib.h>
#import <string.h>
#import <wchar.h>

#import "OFXMLFactory.h"





inline void
check_result(char *result, const char *should)
{
	/* Use wprintf here so we don't mix printf and wprintf! */


	if (!strcmp(result, should))
		wprintf(L"%s is expected result\n", result);


	else {


		wprintf(L"%s is NOT expected result!\n", result);
		exit(1);
	}

	free(result);
}

inline void
check_result_wide(wchar_t *result, const wchar_t *should)
{


	if (!wcscmp(result, should))
		wprintf(L"%ls is expected result\n", result);


	else {


		wprintf(L"%ls is NOT expected result!\n", result);
		exit(1);
	}

	free(result);
}

inline void







>
>
>
>




>

|
|
>
>
|
>
>










>
>
|
|
>
>
|
>
>
|







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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

#import <stdlib.h>
#import <string.h>
#import <wchar.h>

#import "OFXMLFactory.h"

#define NUM_TESTS 10

static int i;

inline void
check_result(char *result, const char *should)
{
	/* Use wprintf here so we don't mix printf and wprintf! */
	i++;

	if (!strcmp(result, should)) {
		wprintf(L"\r\033[1;%dmchar* tests successful:    %2d/%d\033[0m",
		    (i == NUM_TESTS ? 32 : 33), i, NUM_TESTS);
		fflush(stdout);
	} else {
		wprintf(L"\r\033[1;31mchar* test %d/%d failed!\033[0m\n",
		    i, NUM_TESTS);
		wprintf(L"%s is NOT expected result!\n", result);
		exit(1);
	}

	free(result);
}

inline void
check_result_wide(wchar_t *result, const wchar_t *should)
{
	i++;

	if (!wcscmp(result, should)) {
		wprintf(L"\r\033[1;%dmwchar_t* tests successful: %2d/%d\033[0m",
		    (i == NUM_TESTS ? 32 : 33), i, NUM_TESTS);
		fflush(stdout);
	} else {
		wprintf(L"\r\033[1;31mwchar_t* test %d/%d failed!\033[0m\n",
		    i, NUM_TESTS);
		wprintf(L"%s is NOT expected result!\n", result);
		exit(1);
	}

	free(result);
}

inline void
221
222
223
224
225
226
227

228
229
230
231
232
233

234
235
236

237
238
239
	    [OFXMLFactory escapeWideCString: L"<hallo> &welt'\"!&"],
	    L"&lt;hallo&gt; &amp;welt&apos;&quot;!&amp;");
}


int main()
{

	test_escape();
       	test_create_stanza();
       	test_concat();

	wprintf(L"== Now testing with wide C strings ==\n");


	test_escape_wide();
	test_create_stanza_wide();
	test_concat_wide();


	return 0;
}







>



<
|

>



>



236
237
238
239
240
241
242
243
244
245
246

247
248
249
250
251
252
253
254
255
256
	    [OFXMLFactory escapeWideCString: L"<hallo> &welt'\"!&"],
	    L"&lt;hallo&gt; &amp;welt&apos;&quot;!&amp;");
}


int main()
{
	i = 0;
	test_escape();
       	test_create_stanza();
       	test_concat();

	wprintf(L"\n");

	i = 0;
	test_escape_wide();
	test_create_stanza_wide();
	test_concat_wide();
	wprintf(L"\n");

	return 0;
}