Add tests for MET time zone setup

This commit is contained in:
rfm 2024-12-31 13:13:04 +00:00
parent 7bb34b7102
commit 7072a38eb3
2 changed files with 19 additions and 10 deletions

View file

@ -13,7 +13,8 @@ int main()
NSMutableArray *tmpArray;
NSMutableDictionary *myLocale;
NSCalendarDate *myBirthday;
NSCalendarDate *anotherDay;
NSCalendarDate *anotherDay;
NSTimeZone *tz;
myLocale = westernLocale();
@ -72,13 +73,17 @@ int main()
[tmpArray addObject: @"PM"];
[myLocale setObject: tmpArray forKey: NSAMPMDesignation];
tz = [NSTimeZone timeZoneWithName: @"MET"];
PASS_EQUAL([tz name], @"MET", "got time zone for dates")
myBirthday = [NSCalendarDate dateWithYear: 1974
month: 11
day: 20
hour: 13
minute: 0
second: 0
timeZone: [NSTimeZone timeZoneWithName: @"MET"]];
timeZone: tz];
PASS_EQUAL([myBirthday timeZone], tz, "myBirthday has expected time zone")
anotherDay = [NSCalendarDate dateWithYear: 1974
month: 1
@ -86,7 +91,8 @@ int main()
hour: 3
minute: 0
second: 0
timeZone: [NSTimeZone timeZoneWithName: @"MET"]];
timeZone: tz];
PASS_EQUAL([anotherDay timeZone], tz, "anotherDay has expected time zone")
PASS([[myBirthday descriptionWithCalendarFormat: @"%%"
locale: myLocale] isEqualToString: @"%"],

View file

@ -9,31 +9,34 @@ int main()
current = [NSTimeZone defaultTimeZone];
PASS(current != nil && [current isKindOfClass: [NSTimeZone class]],
"+defaultTimeZone works");
"+defaultTimeZone works")
current = [NSTimeZone localTimeZone];
PASS(current != nil && [current isKindOfClass: [NSTimeZone class]],
"+localTimeZone works");
"+localTimeZone works")
current = [NSTimeZone systemTimeZone];
PASS(current != nil && [current isKindOfClass: [NSTimeZone class]],
"+systemTimeZone works");
"+systemTimeZone works")
current = [NSTimeZone timeZoneForSecondsFromGMT: 900];
PASS(current != nil && [current isKindOfClass: [NSTimeZone class]],
"+timeZoneForSecondsFromGMT works");
"+timeZoneForSecondsFromGMT: works")
current = [NSTimeZone timeZoneForSecondsFromGMT: 90000];
PASS(current == nil,
"+timeZoneForSecondsFromGMT fails for bad offset");
"+timeZoneForSecondsFromGMT: fails for bad offset")
current = [NSTimeZone timeZoneWithAbbreviation: @"MST"];
PASS(current != nil && [current isKindOfClass: [NSTimeZone class]],
"+timeZoneWithAbbreviation works");
"+timeZoneWithAbbreviation: works")
current = [NSTimeZone timeZoneWithName: @"GB"];
PASS(current != nil && [current isKindOfClass: [NSTimeZone class]],
"+timeZoneWithName works");
"+timeZoneWithName: works")
current = [NSTimeZone timeZoneWithName: @"MET"];
PASS_EQUAL([current name], @"MET", "+timeZoneWithName: preserved name")
[arp release]; arp = nil;
return 0;