ObjFW  Check-in [9557564b3a]

Overview
Comment:Print the localization at the end of the tests
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9557564b3abeb6f8d738e42a8207ff42f13f4ba6ce12b40ba85545c176acf7a3
User & Date: js on 2018-04-15 14:48:19
Other Links: manifest | tags
Context
2018-04-15
14:49
OFLocalization: Fix setting the territory check-in: 4dfd47aeaa user: js tags: trunk
14:48
Print the localization at the end of the tests check-in: 9557564b3a user: js tags: trunk
14:18
Disable shared libraries and threads on AmigaOS 4 check-in: 9b75d1994c user: js tags: trunk
Changes

Modified src/OFString.h from [0b96a25a15] to [0a00717fb4].

1201
1202
1203
1204
1205
1206
1207

1208
1209
1210
1211
1212
1213
1214
#endif
@end

#ifdef __cplusplus
extern "C" {
#endif
extern of_string_encoding_t of_string_parse_encoding(OFString *);

extern size_t of_string_utf8_encode(of_unichar_t, char *);
extern ssize_t of_string_utf8_decode(const char *, size_t, of_unichar_t *);
extern size_t of_string_utf16_length(const of_char16_t *);
extern size_t of_string_utf32_length(const of_char32_t *);
#ifdef __cplusplus
}
#endif







>







1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
#endif
@end

#ifdef __cplusplus
extern "C" {
#endif
extern of_string_encoding_t of_string_parse_encoding(OFString *);
extern OFString *_Nullable of_string_name_of_encoding(of_string_encoding_t);
extern size_t of_string_utf8_encode(of_unichar_t, char *);
extern ssize_t of_string_utf8_decode(const char *, size_t, of_unichar_t *);
extern size_t of_string_utf16_length(const of_char16_t *);
extern size_t of_string_utf32_length(const of_char32_t *);
#ifdef __cplusplus
}
#endif

Modified src/OFString.m from [2a7e99dee8] to [c0c777343c].

186
187
188
189
190
191
192







































193
194
195
196
197
198
199
	else
		@throw [OFInvalidEncodingException exception];

	objc_autoreleasePoolPop(pool);

	return encoding;
}








































size_t
of_string_utf8_encode(of_unichar_t character, char *buffer)
{
	if (character < 0x80) {
		buffer[0] = character;
		return 1;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
	else
		@throw [OFInvalidEncodingException exception];

	objc_autoreleasePoolPop(pool);

	return encoding;
}

OFString *
of_string_name_of_encoding(of_string_encoding_t encoding)
{
	switch (encoding) {
	case OF_STRING_ENCODING_UTF_8:
		return @"UTF-8";
	case OF_STRING_ENCODING_ASCII:
		return @"ASCII";
	case OF_STRING_ENCODING_ISO_8859_1:
		return @"ISO 8859-1";
	case OF_STRING_ENCODING_ISO_8859_2:
		return @"ISO 8859-2";
	case OF_STRING_ENCODING_ISO_8859_3:
		return @"ISO 8859-3";
	case OF_STRING_ENCODING_ISO_8859_15:
		return @"ISO 8859-15";
	case OF_STRING_ENCODING_WINDOWS_1251:
		return @"Windows-1251";
	case OF_STRING_ENCODING_WINDOWS_1252:
		return @"Windows-1252";
	case OF_STRING_ENCODING_CODEPAGE_437:
		return @"Codepage 437";
	case OF_STRING_ENCODING_CODEPAGE_850:
		return @"Codepage 850";
	case OF_STRING_ENCODING_CODEPAGE_858:
		return @"Codepage 858";
	case OF_STRING_ENCODING_MAC_ROMAN:
		return @"Mac Roman";
	case OF_STRING_ENCODING_KOI8_R:
		return @"KOI8-R";
	case OF_STRING_ENCODING_KOI8_U:
		return @"KOI8-U";
	case OF_STRING_ENCODING_AUTODETECT:
		return @"autodetect";
	}

	return nil;
}

size_t
of_string_utf8_encode(of_unichar_t character, char *buffer)
{
	if (character < 0x80) {
		buffer[0] = character;
		return 1;

Modified tests/Makefile from [c6bfc1c65e] to [4850c1be9d].

17
18
19
20
21
22
23

24
25
26
27
28
29
30
       OFDateTests.m			\
       OFDictionaryTests.m		\
       OFHTTPCookieTests.m		\
       OFHTTPCookieManagerTests.m	\
       OFInvocationTests.m		\
       OFJSONTests.m			\
       OFListTests.m			\

       OFMethodSignatureTests.m		\
       OFNumberTests.m			\
       OFObjectTests.m			\
       OFPropertyListTests.m		\
       OFSetTests.m			\
       OFStreamTests.m			\
       OFStringTests.m			\







>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
       OFDateTests.m			\
       OFDictionaryTests.m		\
       OFHTTPCookieTests.m		\
       OFHTTPCookieManagerTests.m	\
       OFInvocationTests.m		\
       OFJSONTests.m			\
       OFListTests.m			\
       OFLocalizationTests.m		\
       OFMethodSignatureTests.m		\
       OFNumberTests.m			\
       OFObjectTests.m			\
       OFPropertyListTests.m		\
       OFSetTests.m			\
       OFStreamTests.m			\
       OFStringTests.m			\

Added tests/OFLocalizationTests.m version [5929d44b99].















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
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
48
49
50
51
52
53
54
55
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 *               2018
 *   Jonathan Schleifer <js@heap.zone>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFLocalization.h"
#import "OFAutoreleasePool.h"

#import "TestsAppDelegate.h"

@implementation TestsAppDelegate (OFLocalizationTests)
- (void)localizationTests
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *msg;

	msg = [OFString stringWithFormat:
	     @"[OFLocalization] Language: %@\n", [OFLocalization language]];
	[self outputString: msg
		   inColor: GREEN];

	msg = [OFString stringWithFormat:
	    @"[OFLocalization] Territory: %@\n", [OFLocalization territory]];
	[self outputString: msg
		   inColor: GREEN];

	msg = [OFString stringWithFormat:
	    @"[OFLocalization] Encoding: %@\n",
	    of_string_name_of_encoding([OFLocalization encoding])];
	[self outputString: msg
		   inColor: GREEN];

	msg = [OFString stringWithFormat:
	    @"[OFLocalization] Decimal point: %@\n",
	    [OFLocalization decimalPoint]];
	[self outputString: msg
		   inColor: GREEN];

	[pool drain];
}
@end

Modified tests/TestsAppDelegate.h from [0a503e50ce] to [cf65eeb924].

53
54
55
56
57
58
59







60
61
62
63
64
65
66
				   inModule: module];	\
			_fails++;			\
		}					\
	}
#define R(...) (__VA_ARGS__, 1)

@class OFString;








@interface TestsAppDelegate: OFObject <OFApplicationDelegate>
{
	int _fails;
}

- (void)outputString: (OFString *)str







>
>
>
>
>
>
>







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
				   inModule: module];	\
			_fails++;			\
		}					\
	}
#define R(...) (__VA_ARGS__, 1)

@class OFString;

enum {
	NO_COLOR,
	RED,
	GREEN,
	YELLOW
};

@interface TestsAppDelegate: OFObject <OFApplicationDelegate>
{
	int _fails;
}

- (void)outputString: (OFString *)str
128
129
130
131
132
133
134




135
136
137
138
139
140
141
@interface TestsAppDelegate (OFKernelEventObserverTests)
- (void)kernelEventObserverTests;
@end

@interface TestsAppDelegate (OFListTests)
- (void)listTests;
@end





@interface TestsAppDelegate (OFMD5HashTests)
- (void)MD5HashTests;
@end

@interface TestsAppDelegate (OFMethodSignatureTests)
- (void)methodSignatureTests;







>
>
>
>







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
@interface TestsAppDelegate (OFKernelEventObserverTests)
- (void)kernelEventObserverTests;
@end

@interface TestsAppDelegate (OFListTests)
- (void)listTests;
@end

@interface TestsAppDelegate (OFLocalizationTests)
- (void)localizationTests;
@end

@interface TestsAppDelegate (OFMD5HashTests)
- (void)MD5HashTests;
@end

@interface TestsAppDelegate (OFMethodSignatureTests)
- (void)methodSignatureTests;

Modified tests/TestsAppDelegate.m from [119c280046] to [a068037952].

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# undef asm
#endif

#ifdef OF_NINTENDO_3DS
# include <3ds.h>
#endif

enum {
	NO_COLOR,
	RED,
	GREEN,
	YELLOW
};

#ifdef OF_PSP
static int
exit_cb(int arg1, int arg2, void *arg)
{
	sceKernelExitGame();

	return 0;







<
<
<
<
<
<
<







56
57
58
59
60
61
62







63
64
65
66
67
68
69
# undef asm
#endif

#ifdef OF_NINTENDO_3DS
# include <3ds.h>
#endif








#ifdef OF_PSP
static int
exit_cb(int arg1, int arg2, void *arg)
{
	sceKernelExitGame();

	return 0;
437
438
439
440
441
442
443


444
445
446
447
448
449
450
	[self serializationTests];
#endif
	[self JSONTests];
	[self propertyListTests];
#if defined(OF_HAVE_PLUGINS)
	[self pluginTests];
#endif



#if defined(OF_IOS)
	[self outputString: [OFString stringWithFormat: @"%d tests failed!",
							_fails]
		   inColor: NO_COLOR];
	[OFApplication terminateWithStatus: _fails];
#elif defined(OF_WII)







>
>







430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
	[self serializationTests];
#endif
	[self JSONTests];
	[self propertyListTests];
#if defined(OF_HAVE_PLUGINS)
	[self pluginTests];
#endif

	[self localizationTests];

#if defined(OF_IOS)
	[self outputString: [OFString stringWithFormat: @"%d tests failed!",
							_fails]
		   inColor: NO_COLOR];
	[OFApplication terminateWithStatus: _fails];
#elif defined(OF_WII)