mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-18 19:48:53 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user