Monotone-Parent: b2324fd0b056d26c1f593b22e0516160fd06bd3c

Monotone-Revision: 32ad0a6147be7ae69fe1339fe1a08de4fbf7fc9b

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-08-31T19:56:45
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-08-31 19:56:45 +00:00
parent d4c7a0520a
commit dcd38d997a
3 changed files with 70 additions and 7 deletions

View File

@@ -22,10 +22,13 @@
#import <Foundation/NSException.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
#import "SOGo/NSScanner+BSJSONAdditions.h"
#import "SOGo/NSDictionary+BSJSONAdditions.h"
#import "SOGo/NSString+Utilities.h"
#import "SOGoTest.h"
@interface TestNSScannerBSJSONAdditions : SOGoTest
@@ -60,9 +63,36 @@
}
}
- (void) test_scanJSONNumber
{
NSScanner *testScanner;
NSNumber *result;
testScanner = [NSScanner scannerWithString: @""];
[testScanner scanJSONNumber: &result];
testEquals (result, nil);
testScanner = [NSScanner scannerWithString: @"0"];
[testScanner scanJSONNumber: &result];
testEquals (result, [NSNumber numberWithInt: 0]);
testScanner = [NSScanner scannerWithString: @"-1"];
[testScanner scanJSONNumber: &result];
testEquals (result, [NSNumber numberWithInt: -1]);
testScanner = [NSScanner scannerWithString: @"12.3456"];
[testScanner scanJSONNumber: &result];
testEquals (result, [NSNumber numberWithDouble: 12.3456]);
testScanner = [NSScanner scannerWithString: @"-312.3456"];
[testScanner scanJSONNumber: &result];
testEquals (result, [NSNumber numberWithDouble: -312.3456]);
}
@end
@interface TestNSDictionaryBSJSONAdditions : SOGoTest
@end
@implementation TestNSDictionaryBSJSONAdditions
@@ -91,3 +121,4 @@
}
@end