mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Use UTF8String rather than cString
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40393 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
872d116a9b
commit
0cb08a8778
6 changed files with 92 additions and 92 deletions
|
@ -33,7 +33,7 @@ int main()
|
|||
}
|
||||
NS_HANDLER
|
||||
PASS(0, "NSZoneFree() calloc'd buffer %s",
|
||||
[[localException name] cString]);
|
||||
[[localException name] UTF8String]);
|
||||
NS_ENDHANDLER
|
||||
|
||||
NS_DURING
|
||||
|
@ -41,7 +41,7 @@ int main()
|
|||
PASS(0, "NSZoneFree() free'd buffer throws exception");
|
||||
NS_HANDLER
|
||||
PASS(1, "NSZoneFree() free'd buffer throws exception: %s",
|
||||
[[localException name] cString]);
|
||||
[[localException name] UTF8String]);
|
||||
NS_ENDHANDLER
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ int main()
|
|||
}
|
||||
NS_HANDLER
|
||||
PASS(0, "NSZoneFree() malloc'd buffer %s",
|
||||
[[localException name] cString]);
|
||||
[[localException name] UTF8String]);
|
||||
NS_ENDHANDLER
|
||||
|
||||
ovp = NSZoneMalloc(aZone, 1000);
|
||||
|
|
|
@ -68,14 +68,14 @@ int main()
|
|||
data = [@"Folded\r\n : testing\r\n" dataUsingEncoding:enc];
|
||||
PASS([parser parse:data] && [parser isInHeaders], "Folded header is ok");
|
||||
|
||||
PASS([@"<hello>" isEqual: [doc contentID]],"Parsed partial header as expected %s",[[doc contentID] cString]);
|
||||
PASS([@"<hello>" isEqual: [doc contentID]],"Parsed partial header as expected %s",[[doc contentID] UTF8String]);
|
||||
|
||||
PASS([doc headerNamed: @"Folded"] == nil,"Folded header not complete until next starts");
|
||||
|
||||
data = [@"\r" dataUsingEncoding:enc];
|
||||
PASS([parser parse:data] && [parser isInHeaders], "partial end-of-line is ok");
|
||||
|
||||
PASS([[[doc headerNamed:@"Folded"] value] isEqual: @"testing"],"Parsed folded header as expected %s",[[[doc headerNamed:@"Folded"] value] cString]);
|
||||
PASS([[[doc headerNamed:@"Folded"] value] isEqual: @"testing"],"Parsed folded header as expected %s",[[[doc headerNamed:@"Folded"] value] UTF8String]);
|
||||
|
||||
data = [@"\n" dataUsingEncoding:enc];
|
||||
PASS([parser parse:data] && ![parser isInHeaders], "completing end-of-line is ok");
|
||||
|
|
|
@ -110,26 +110,26 @@ int main()
|
|||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date1 testDateValues: 1999 : 12 : 31 : 23 : 59 : 59],
|
||||
"date check with %s", [[date1 description] cString]);
|
||||
"date check with %s", [[date1 description] UTF8String]);
|
||||
date2 = [date1 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 1];
|
||||
PASS([date2 testDateValues: 2000 : 01 : 01 : 00 : 00 : 00],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 1];
|
||||
PASS([date2 testDateValues: 2000 : 01 : 01 : 00 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 1 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2000 : 01 : 01 : 01 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: -2 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 1999 : 12 : 31 : 23 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
/* Y2K is a leap year checks */
|
||||
date2 = [NSCalendarDate dateWithString: @"2000-2-28 23:59:59"
|
||||
|
@ -137,73 +137,73 @@ int main()
|
|||
locale: locale];
|
||||
|
||||
PASS([date2 testDateValues: 2000 : 02 : 28 : 23 : 59 : 59],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 1];
|
||||
PASS([date2 testDateValues: 2000 : 02 : 29 : 00 : 00 : 00],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 1];
|
||||
PASS([date2 testDateValues: 2000 : 02 : 29 : 00 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 1 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2000 : 02 : 29 : 01 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: -2 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2000 : 02 : 28 : 23 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 5 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2000 : 02 : 29 : 04 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 1
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2001 : 03 : 01 : 04 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: -1 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2001 : 02 : 28 : 04 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 1
|
||||
months: 0 days: 1 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 03 : 01 : 04 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
/* 2004 is a year leap check */
|
||||
date2 = [NSCalendarDate dateWithString: @"2004-2-28 23:59:59"
|
||||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date2 testDateValues: 2004 : 02 : 28 : 23 : 59 : 59],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 1];
|
||||
PASS([date2 testDateValues: 2004 : 02 : 29 : 00 : 00 : 00],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 1];
|
||||
PASS([date2 testDateValues: 2004 : 02 : 29 : 00 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 1 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2004 : 02 : 29 : 01 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: -2 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2004 : 02 : 28 : 23 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
/* 2100 is not a leap year */
|
||||
|
||||
|
@ -211,25 +211,25 @@ int main()
|
|||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date2 testDateValues: 2100 : 02 : 28 : 23 : 59 : 59],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 1];
|
||||
PASS([date2 testDateValues: 2100 : 03 : 01 : 00 : 00 : 00],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 1];
|
||||
PASS([date2 testDateValues: 2100 : 03 : 01 : 00 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 1 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2100 : 03 : 01 : 01 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: -2 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2100 : 02 : 28 : 23 : 00 : 01],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
/* daylight savings time checks */
|
||||
[NSTimeZone setDefaultTimeZone: [NSTimeZone timeZoneWithName: @"GB"]];
|
||||
|
@ -238,31 +238,31 @@ int main()
|
|||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date2 testDateValues: 2002 : 03 : 31 : 00 : 30 : 00],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 1 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 03 : 31 : 02 : 30 : 00],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: -1 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 03 : 31 : 00 : 30 : 00],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 2 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 03 : 31 : 02 : 30 : 00],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: -1 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 03 : 31 : 00 : 30 : 00],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: -1 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 03 : 30 : 23 : 30 : 00],
|
||||
"date check with %s", [[date2 description] cString]);
|
||||
"date check with %s", [[date2 description] UTF8String]);
|
||||
/* End daylight savings checks */
|
||||
|
||||
/* Seconds calculation checks */
|
||||
|
@ -270,94 +270,94 @@ int main()
|
|||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date second calculation check with %s", [[date2 description] cString]);
|
||||
"date second calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: -1];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 29 : 59],
|
||||
"date second calculation check with %s", [[date2 description] cString]);
|
||||
"date second calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 1];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date second calculation check with %s", [[date2 description] cString]);
|
||||
"date second calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 2];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 02],
|
||||
"date second calculation check with %s", [[date2 description] cString]);
|
||||
"date second calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
/* Minutes calculation checks */
|
||||
date2 = [NSCalendarDate dateWithString: @"2002-10-27 00:30:00"
|
||||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date minute calculation check with %s", [[date2 description] cString]);
|
||||
"date minute calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: -1 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 29 : 00],
|
||||
"date minute calculation check with %s", [[date2 description] cString]);
|
||||
"date minute calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 1 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date minute calculation check with %s", [[date2 description] cString]);
|
||||
"date minute calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 1 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 31 : 00],
|
||||
"date minute calculation check with %s", [[date2 description] cString]);
|
||||
"date minute calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
/* Hour calculation checks */
|
||||
date2 = [NSCalendarDate dateWithString: @"2002-10-27 00:30:00"
|
||||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date hour calculation check with %s", [[date2 description] cString]);
|
||||
"date hour calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: -1 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 26 : 23 : 30 : 00],
|
||||
"date hour calculation check with %s", [[date2 description] cString]);
|
||||
"date hour calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 1 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date hour calculation check with %s", [[date2 description] cString]);
|
||||
"date hour calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 2 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 02 : 30 : 00],
|
||||
"date hour calculation check with %s", [[date2 description] cString]);
|
||||
"date hour calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
/* Days calculation checks */
|
||||
date2 = [NSCalendarDate dateWithString: @"2002-10-27 00:30:00"
|
||||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date day calculation check with %s", [[date2 description] cString]);
|
||||
"date day calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: -1 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 26 : 00 : 30 : 00],
|
||||
"date day calculation check with %s", [[date2 description] cString]);
|
||||
"date day calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 1 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date day calculation check with %s", [[date2 description] cString]);
|
||||
"date day calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 2 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 29 : 00 : 30 : 00],
|
||||
"date day calculation check with %s", [[date2 description] cString]);
|
||||
"date day calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [NSCalendarDate dateWithString: @"2002-10-27 00:00:00"
|
||||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 00 : 00],
|
||||
"date day calculation check with %s", [[date2 description] cString]);
|
||||
"date day calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [NSCalendarDate dateWithString: @"2002-10-26 24:00:00"
|
||||
calendarFormat: val2
|
||||
|
@ -370,44 +370,44 @@ int main()
|
|||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date month calculation check with %s", [[date2 description] cString]);
|
||||
"date month calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: -1 days: 0 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 9 : 27 : 00 : 30 : 00],
|
||||
"date month calculation check with %s", [[date2 description] cString]);
|
||||
"date month calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 1 days: 0 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date month calculation check with %s", [[date2 description] cString]);
|
||||
"date month calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 2 days: 0 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 12 : 27 : 00 : 30 : 00],
|
||||
"date month calculation check with %s", [[date2 description] cString]);
|
||||
"date month calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
/* Years calculation checks */
|
||||
date2 = [NSCalendarDate dateWithString: @"2002-10-27 00:30:00"
|
||||
calendarFormat: val2
|
||||
locale: locale];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date year calculation check with %s", [[date2 description] cString]);
|
||||
"date year calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: -1
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2001 : 10 : 27 : 00 : 30 : 00],
|
||||
"date year calculation check with %s", [[date2 description] cString]);
|
||||
"date year calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 1
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2002 : 10 : 27 : 00 : 30 : 00],
|
||||
"date year calculation check with %s", [[date2 description] cString]);
|
||||
"date year calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
date2 = [date2 dateByAddingYears: 2
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: 0];
|
||||
PASS([date2 testDateValues: 2004 : 10 : 27 : 00 : 30 : 00],
|
||||
"date year calculation check with %s", [[date2 description] cString]);
|
||||
"date year calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
[NSTimeZone setDefaultTimeZone: [NSTimeZone timeZoneWithName: @"GMT"]];
|
||||
|
||||
|
@ -417,7 +417,7 @@ int main()
|
|||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 1 days: 0 hours: 2 minutes: 10 seconds: 0];
|
||||
PASS([date2 testDateValues: 2006 : 11 : 1 : 2 : 10 : 00],
|
||||
"date year calculation check with %s", [[date2 description] cString]);
|
||||
"date year calculation check with %s", [[date2 description] UTF8String]);
|
||||
PASS([[date2 timeZone] isEqual: tz],
|
||||
"date year calculation preserves timezone");
|
||||
|
||||
|
@ -427,7 +427,7 @@ int main()
|
|||
date2 = [date2 dateByAddingYears: 0
|
||||
months: 0 days: 0 hours: 0 minutes: 0 seconds: -3600];
|
||||
PASS([date2 testDateValues: 2016 : 1 : 6 : 00 : 00 : 00],
|
||||
"date year calculation check with %s", [[date2 description] cString]);
|
||||
"date year calculation check with %s", [[date2 description] UTF8String]);
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
|
|
|
@ -13,35 +13,35 @@
|
|||
|
||||
/* these macros should only be used in the scope of main */
|
||||
#define TEST_INVOKE(selx) \
|
||||
{ \
|
||||
NS_DURING \
|
||||
NSMethodSignature *sig = nil; \
|
||||
sig = [tar methodSignatureForSelector:selx]; \
|
||||
inv = [NSInvocation invocationWithMethodSignature:sig]; \
|
||||
[inv setSelector:selx]; \
|
||||
[inv invokeWithTarget:tar]; \
|
||||
PASS(1,"Invoke %s",[NSStringFromSelector(selx) cString]); \
|
||||
NS_HANDLER \
|
||||
PASS(0,"Invoke %s",[NSStringFromSelector(selx) cString]); \
|
||||
[localException raise]; \
|
||||
NS_ENDHANDLER \
|
||||
}
|
||||
{ \
|
||||
NS_DURING \
|
||||
NSMethodSignature *sig = nil; \
|
||||
sig = [tar methodSignatureForSelector:selx]; \
|
||||
inv = [NSInvocation invocationWithMethodSignature:sig]; \
|
||||
[inv setSelector:selx]; \
|
||||
[inv invokeWithTarget:tar]; \
|
||||
PASS(1,"Invoke %s",[NSStringFromSelector(selx) UTF8String]); \
|
||||
NS_HANDLER \
|
||||
PASS(0,"Invoke %s",[NSStringFromSelector(selx) UTF8String]); \
|
||||
[localException raise]; \
|
||||
NS_ENDHANDLER \
|
||||
}
|
||||
|
||||
#define TEST_INVOKE_ARG(selx,argp) \
|
||||
{ \
|
||||
NS_DURING \
|
||||
NSMethodSignature *sig = nil; \
|
||||
sig = [tar methodSignatureForSelector:selx]; \
|
||||
inv = [NSInvocation invocationWithMethodSignature:sig]; \
|
||||
[inv setSelector:selx]; \
|
||||
[inv setArgument:argp atIndex:2]; \
|
||||
[inv invokeWithTarget:tar]; \
|
||||
PASS(1,"Invoke %s",[NSStringFromSelector(selx) cString]); \
|
||||
NS_HANDLER \
|
||||
PASS(0,"Invoke %s",[NSStringFromSelector(selx) cString]); \
|
||||
[localException raise]; \
|
||||
NS_ENDHANDLER \
|
||||
}
|
||||
{ \
|
||||
NS_DURING \
|
||||
NSMethodSignature *sig = nil; \
|
||||
sig = [tar methodSignatureForSelector:selx]; \
|
||||
inv = [NSInvocation invocationWithMethodSignature:sig]; \
|
||||
[inv setSelector:selx]; \
|
||||
[inv setArgument:argp atIndex:2]; \
|
||||
[inv invokeWithTarget:tar]; \
|
||||
PASS(1,"Invoke %s",[NSStringFromSelector(selx) UTF8String]); \
|
||||
NS_HANDLER \
|
||||
PASS(0,"Invoke %s",[NSStringFromSelector(selx) UTF8String]); \
|
||||
[localException raise]; \
|
||||
NS_ENDHANDLER \
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
|
@ -105,7 +105,7 @@ int main()
|
|||
[run cancelPerformSelectorsWithTarget: str];
|
||||
date = [NSDate dateWithTimeIntervalSinceNow: delay];
|
||||
[run runUntilDate: date];
|
||||
PASS([str isEqualToString: @""], "-cancelPerformSelectorsWithTarget: works %s",[str cString]);
|
||||
PASS([str isEqualToString: @""], "-cancelPerformSelectorsWithTarget: works %s",[str UTF8String]);
|
||||
|
||||
[fh closeFile];
|
||||
[fh release];
|
||||
|
|
|
@ -130,11 +130,11 @@ void testReadBasicType_##testName (char *pre, testType *expect, testType *toDeco
|
|||
[unArch decodeValueOfObjCType:@encode(testType) at:toDecode]; \
|
||||
NS_HANDLER \
|
||||
NSLog(@"%@ %@", [localException name], [localException reason]); \
|
||||
PASS(0, "can unarchive %s from %s", pre, [fileName cString]); \
|
||||
PASS(0, "can unarchive %s from %s", pre, [fileName UTF8String]); \
|
||||
NS_ENDHANDLER \
|
||||
str2 = [unArch decodeObject]; \
|
||||
PASS((VAL_TEST(*expect,*toDecode) && [str isEqual:str2]), \
|
||||
"can unarchive %s from %s", pre, [fileName cString]); \
|
||||
"can unarchive %s from %s", pre, [fileName UTF8String]); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue