Monotone-Parent: 5cb9c48b0138d6348fec10e7ae5a7a5e6b8403c2

Monotone-Revision: 6dfadf575c7c0be4ae75752239ab48f7531dba38

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-04-01T21:10:10
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2011-04-01 21:10:10 +00:00
parent f51d1fa665
commit 6f339121a2
2 changed files with 21 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2011-04-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Tests/Unit/TestSBJsonParser.m (-test_parseJSONString): input and
expected result are embedded in an array since SBJsonParser needs
a "container" class.
(-test_parseJSONNumber): same as above.
2011-04-01 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentObject.m (-PUTAction:):

View File

@ -38,7 +38,8 @@
- (void) test_parseJSONString
{
SBJsonParser *parser;
NSString *currentString, *expected, *error;
NSString *currentString, *error;
NSArray *expected;
NSObject *resultObject;
int count;
NSString *testStrings[] = { @"\"\\\\\"", @"\\",
@ -52,8 +53,10 @@
count = 0;
while ((currentString = testStrings[count * 2]))
{
resultObject = [parser objectWithString: currentString];
expected = testStrings[count * 2 + 1];
resultObject = [parser objectWithString: [NSString stringWithFormat:
@"[%@]",
currentString]];
expected = [NSArray arrayWithObject: testStrings[count * 2 + 1]];
error = [NSString stringWithFormat:
@"objects '%@' and '%@' differs (count: %d)",
expected, resultObject, count];
@ -73,17 +76,17 @@
result = [parser objectWithString: @""];
testEquals (result, nil);
result = [parser objectWithString: @"0"];
testEquals (result, [NSNumber numberWithInt: 0]);
result = [parser objectWithString: @"[ 0 ]"];
testEquals (result, [NSArray arrayWithObject: [NSNumber numberWithInt: 0]]);
result = [parser objectWithString: @"-1"];
testEquals (result, [NSNumber numberWithInt: -1]);
result = [parser objectWithString: @"[ -1 ]"];
testEquals (result, [NSArray arrayWithObject: [NSNumber numberWithInt: -1]]);
result = [parser objectWithString: @"12.3456"];
testEquals (result, [NSNumber numberWithDouble: 12.3456]);
result = [parser objectWithString: @"[ 12.3456 ]"];
testEquals (result, [NSArray arrayWithObject: [NSNumber numberWithDouble: 12.3456]]);
result = [parser objectWithString: @"-312.3456"];
testEquals (result, [NSNumber numberWithDouble: -312.3456]);
result = [parser objectWithString: @"[ -312.3456 ]"];
testEquals (result, [NSArray arrayWithObject: [NSNumber numberWithDouble: -312.3456]]);
}
@end