diff options
Diffstat (limited to 'Tests/ObjC++')
-rw-r--r-- | Tests/ObjC++/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/ObjC++/objc++.mm | 23 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Tests/ObjC++/CMakeLists.txt b/Tests/ObjC++/CMakeLists.txt new file mode 100644 index 000000000..c892bd0a1 --- /dev/null +++ b/Tests/ObjC++/CMakeLists.txt @@ -0,0 +1,6 @@ +# a simple objc++ test case that uses Cocoa framework +PROJECT (ObjC++) + +ADD_EXECUTABLE (ObjC++ objc++.mm) +TARGET_LINK_LIBRARIES(ObjC++ "-framework Cocoa") + diff --git a/Tests/ObjC++/objc++.mm b/Tests/ObjC++/objc++.mm new file mode 100644 index 000000000..f0be25682 --- /dev/null +++ b/Tests/ObjC++/objc++.mm @@ -0,0 +1,23 @@ +#import <Cocoa/Cocoa.h> +#import <iostream> +using namespace std; + +int main() +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + NSMutableSet *mySet = [NSMutableSet set]; + cout<<"Adding values to the set."<<endl; + [mySet addObject:[NSNumber numberWithInt:356]]; + [mySet addObject:[NSNumber numberWithInt:550]]; + [mySet addObject:[NSNumber numberWithInt:914]]; + + cout<<"The set contains "<<[mySet count]<<" objects."<<endl; + if ([mySet containsObject:[NSNumber numberWithInt:911]]) + cout<<"It's there!"<<endl; + else + cout<<"It's not there."<<endl; + + [pool release]; + return 0; +} |