-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSunriseSunsetCalculatorTest.m
63 lines (49 loc) · 1.85 KB
/
SunriseSunsetCalculatorTest.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#import "SunriseSunsetCalculatorTest.h"
@implementation SunriseSunsetCalculatorTest : SenTestCase {
SunriseSunsetCalculator *calc;
NSDate *date;
}
- (void) setUp {
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setYear:2008];
[comps setMonth:11];
[comps setDay:1];
NSCalendar *cal = [NSCalendar currentCalendar];
date = [cal dateFromComponents:comps];
calc = [[SunriseSunsetCalculator alloc] initWithLocation: [[Location alloc] initWithLatitude:@"39.9937" Longitude:@"-75.7850"]];
}
- (void) tearDown {
}
- (void) testGetAstronomicalSunrise {
NSString *actual = [calc getAstronomicalSunriseForDate:date];
STAssertTrue([@"06:01" isEqual:actual], @"Wrong time: %@", actual);
}
- (void) testGetAstronomicalSunset {
NSString *actual = [calc getAstronomicalSunsetForDate:date];
STAssertTrue([@"19:32" isEqual:actual], @"Wrong time: %@", actual);
}
- (void) testGetNauticalSunrise {
NSString *actual = [calc getNauticalSunriseForDate:date];
STAssertTrue([@"06:33" isEqual:actual], actual, nil);
}
- (void) testGetNauticalSunset {
NSString *actual = [calc getNauticalSunsetForDate:date];
STAssertTrue([@"19:00" isEqual:actual], @"Wrong time: %@", actual);
}
- (void) testGetCivilSunrise {
NSString *actual = [calc getCivilSunriseForDate:date];
STAssertTrue([@"07:05" isEqual:actual], actual, nil);
}
- (void) testGetCivilSunset {
NSString *actual = [calc getCivilSunsetForDate:date];
STAssertTrue([@"18:28" isEqual:actual], @"Wrong time: %@", actual);
}
- (void) testGetOfficialSunrise {
NSString *actual = [calc getOfficialSunriseForDate:date];
STAssertTrue([@"07:33" isEqual:actual], actual, nil);
}
- (void) testGetOfficialSunset {
NSString *actual = [calc getOfficialSunsetForDate:date];
STAssertTrue([@"18:00" isEqual:actual], @"Wrong time: %@", actual);
}
@end