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
|
* 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"
@implementation TestsAppDelegate (OFLocaleTests)
- (void)localeTests
{
void *pool = objc_autoreleasePoolPush();
[OFStdOut setForegroundColor: [OFColor lime]];
[OFStdOut writeFormat: @"[OFLocale] Language code: %@\n",
[OFLocale languageCode]];
[OFStdOut writeFormat: @"[OFLocale] Country code: %@\n",
[OFLocale countryCode]];
[OFStdOut writeFormat: @"[OFLocale] Encoding: %@\n",
OFStringEncodingName([OFLocale encoding])];
[OFStdOut writeFormat: @"[OFLocale] Decimal separator: %@\n",
[OFLocale decimalSeparator]];
objc_autoreleasePoolPop(pool);
}
@end
|
|
>
<
|
>
|
<
>
>
|
<
>
<
<
>
>
>
|
|
<
<
|
>
<
|
<
>
|
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 "ObjFW.h"
#import "ObjFWTest.h"
@interface OFLocaleTests: OTTestCase
@end
@implementation OFLocaleTests
+ (OFArray OF_GENERIC(OFPair OF_GENERIC(OFString *, id) *) *)summary
{
OFMutableArray *summary = [OFMutableArray array];
#define ADD(name, value) \
[summary addObject: [OFPair pairWithFirstObject: name \
secondObject: value]];
ADD(@"Language code", [OFLocale languageCode])
ADD(@"Country code", [OFLocale countryCode])
ADD(@"Encoding", OFStringEncodingName([OFLocale encoding]))
ADD(@"Decimal separator", [OFLocale decimalSeparator])
#undef ADD
return summary;
}
@end
|