Skip to content

Commit

Permalink
Merge pull request #2 from Pretz/master
Browse files Browse the repository at this point in the history
NSJSONSerialization Test
  • Loading branch information
gabriel committed Oct 26, 2011
2 parents e0d9c5b + 719dd42 commit 19eaac9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Classes/JSONTest.m
Expand Up @@ -69,12 +69,25 @@ - (void)nextiveJsonTest:(NSString *)resourceName count:(NSInteger)count {
[JSONData release];
}

- (void)NSJSONSerializationTest:(NSString *)resourceName count:(NSInteger)count {
NSData *JSONData = [[self loadDataFromResource:resourceName] retain];
NSError *error = nil;
RunWithCount(count, ([NSString stringWithFormat:@"NSJSONSerialization-%@", resourceName]), {
[NSJSONSerialization JSONObjectWithData:JSONData options:0 error:&error];
});
NSAssert1(error == nil, @"Errored: %@", error);
[JSONData release];
}

- (void)runWithResourceName:(NSString *)resourceName count:(NSInteger)count {
[self SBJSONTest:resourceName count:count];
[self YAJLTest:resourceName count:count];
[self touchJSONTest:resourceName count:count];
[self JSONKitTest:resourceName count:count];
[self nextiveJsonTest:resourceName count:count];
if (NSClassFromString(@"NSJSONSerialization")) {
[self NSJSONSerializationTest:resourceName count:count];
}
}

@end
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -5,5 +5,6 @@
- [YAJL (objective-C bindings)](http://github.com/gabriel/yajl-objc)
- [JSONKit](https://github.com/johnezang/JSONKit)
- [NextiveJson](https://github.com/nextive/NextiveJson)
- [NSJSONSerialization](http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40010946)

This is a very basic test that parses some sample JSON files multiple times.

0 comments on commit 19eaac9

Please sign in to comment.