Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from Pretz/master

NSJSONSerialization Test
  • Loading branch information...
commit 19eaac976f7af792cf4ceb17d4ce503cad5dfed0 2 parents e0d9c5b + 719dd42
@gabriel authored
Showing with 14 additions and 0 deletions.
  1. +13 −0 Classes/JSONTest.m
  2. +1 −0  README.md
View
13 Classes/JSONTest.m
@@ -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
View
1  README.md
@@ -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.
Please sign in to comment.
Something went wrong with that request. Please try again.