]> git.saurik.com Git - apple/objc4.git/blob - test/literals.m
objc4-532.2.tar.gz
[apple/objc4.git] / test / literals.m
1 // TEST_CONFIG MEM=arc,mrc CC=clang LANGUAGE=objc,objc++
2 // TEST_CFLAGS -framework Foundation
3
4 #import <Foundation/Foundation.h>
5 #import <Foundation/NSDictionary.h>
6 #import <objc/runtime.h>
7 #import <objc/objc-abi.h>
8 #import <math.h>
9 #include "test.h"
10
11 int main() {
12 PUSH_POOL {
13
14 #if __has_feature(objc_bool) // placeholder until we get a more precise macro.
15 NSArray *array = @[ @1, @2, @YES, @NO, @"Hello", @"World" ];
16 testassert([array count] == 6);
17 NSDictionary *dict = @{ @"Name" : @"John Q. Public", @"Age" : @42 };
18 testassert([dict count] == 2);
19 NSDictionary *numbers = @{ @"π" : @M_PI, @"e" : @M_E };
20 testassert([[numbers objectForKey:@"π"] doubleValue] == M_PI);
21 testassert([[numbers objectForKey:@"e"] doubleValue] == M_E);
22 #endif
23
24 } POP_POOL;
25
26 succeed(__FILE__);
27
28 return 0;
29 }