ObjFW  Diff

Differences From Artifact [fd0d2946e0]:

To Artifact [22509a4b2b]:


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#ifndef _WIN32
#define ZD "%zd"
#else
#define ZD "%u"
#endif

#define NUM_TESTS 10
#define SUCCESS								\
	printf("\r\033[1;%dmTests successful: " ZD "/%d\033[0m",	\
	    (i == NUM_TESTS - 1 ? 32 : 33), i + 1, NUM_TESTS);		\
	fflush(stdout);
#define FAIL								\
	printf("\r\033[K\033[1;31mTest " ZD "/%d failed!\033[m\n",	\
	    i + 1, NUM_TESTS);						\







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#ifndef _WIN32
#define ZD "%zd"
#else
#define ZD "%u"
#endif

#define NUM_TESTS 12
#define SUCCESS								\
	printf("\r\033[1;%dmTests successful: " ZD "/%d\033[0m",	\
	    (i == NUM_TESTS - 1 ? 32 : 33), i + 1, NUM_TESTS);		\
	fflush(stdout);
#define FAIL								\
	printf("\r\033[K\033[1;31mTest " ZD "/%d failed!\033[m\n",	\
	    i + 1, NUM_TESTS);						\
82
83
84
85
86
87
88








89
90
91
92
93
	CHECK_EXCEPT(s1 = [OFString newFromCString: "\xE0\x80"],
	    OFInvalidEncodingException)
	CHECK_EXCEPT(s1 = [OFString newFromCString: "\xF0\x80\x80\xC0"],
	    OFInvalidEncodingException)

	s1 = [OFString newFromCString: "äöü€𝄞"];
	CHECK(!strcmp([[s1 reverse] cString], "𝄞€üöä"))









	puts("");

	return 0;
}







>
>
>
>
>
>
>
>





82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
	CHECK_EXCEPT(s1 = [OFString newFromCString: "\xE0\x80"],
	    OFInvalidEncodingException)
	CHECK_EXCEPT(s1 = [OFString newFromCString: "\xF0\x80\x80\xC0"],
	    OFInvalidEncodingException)

	s1 = [OFString newFromCString: "äöü€𝄞"];
	CHECK(!strcmp([[s1 reverse] cString], "𝄞€üöä"))
	[s1 free];

	/* Format tests */
	s1 = [OFString newFromFormatCString: "%s: %d", "test", 123];
	CHECK(!strcmp([s1 cString], "test: 123"))

	[s1 appendWithFormatCString: "%02X", 15];
	CHECK(!strcmp([s1 cString], "test: 1230F"))

	puts("");

	return 0;
}