@@ -13,29 +13,30 @@ * 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); +#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