ObjFW  Diff

Differences From Artifact [bb15c236d6]:

To Artifact [c000e04b91]:


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
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







-
+
+

-
-
-
+
+
+
-
-
+
+
+
-
+

-
-
+
+
+

-
-
+
+
-
-
-
+
+

-
-
+

-
+


 * 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 "TestsAppDelegate.h"
#import "ObjFW.h"
#import "ObjFWTest.h"

@implementation TestsAppDelegate (OFLocaleTests)
- (void)localeTests
{
@interface OFLocaleTests: OTTestCase
@end

	void *pool = objc_autoreleasePoolPush();

@implementation OFLocaleTests
+ (OFArray OF_GENERIC(OFPair OF_GENERIC(OFString *, id) *) *)summary
{
	[OFStdOut setForegroundColor: [OFColor lime]];
	OFMutableArray *summary = [OFMutableArray array];

	[OFStdOut writeFormat: @"[OFLocale] Language code: %@\n",
	    [OFLocale languageCode]];
#define ADD(name, value)						\
	[summary addObject: [OFPair pairWithFirstObject: name		\
					   secondObject: value]];

	[OFStdOut writeFormat: @"[OFLocale] Country code: %@\n",
	    [OFLocale countryCode]];
	ADD(@"Language code", [OFLocale languageCode])
	ADD(@"Country code", [OFLocale countryCode])

	[OFStdOut writeFormat: @"[OFLocale] Encoding: %@\n",
	    OFStringEncodingName([OFLocale encoding])];
	ADD(@"Encoding", OFStringEncodingName([OFLocale encoding]))
	ADD(@"Decimal separator", [OFLocale decimalSeparator])

	[OFStdOut writeFormat: @"[OFLocale] Decimal separator: %@\n",
	    [OFLocale decimalSeparator]];
#undef ADD

	objc_autoreleasePoolPop(pool);
	return summary;
}
@end