Implement -testPositive.
This commit is contained in:
parent
c020867bce
commit
64fbc7115c
1 changed files with 30 additions and 0 deletions
|
@ -32,6 +32,36 @@
|
||||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)testPositive
|
||||||
|
{
|
||||||
|
NSDictionary *testsDict =
|
||||||
|
@{
|
||||||
|
// key: test name, value: test string
|
||||||
|
//@"Example": @"0:00",
|
||||||
|
@"One Second": @"0:01",
|
||||||
|
@"One Minute": @"1:00",
|
||||||
|
@"One Hour": @"1:00:00",
|
||||||
|
@"One Day": @"1:00:00:00",
|
||||||
|
@"One of Each": @"1:01:01:01",
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TEST_INFO @"Test name: %@, Source string: %@", testName, string
|
||||||
|
|
||||||
|
NSFormatter *secondsFormatter = [[SecondsFormatter alloc] init];
|
||||||
|
|
||||||
|
[testsDict enumerateKeysAndObjectsUsingBlock:
|
||||||
|
^(NSString *testName, NSString *string, BOOL * _Nonnull stop) {
|
||||||
|
NSNumber *value;
|
||||||
|
BOOL result =
|
||||||
|
[secondsFormatter getObjectValue:&value
|
||||||
|
forString:string
|
||||||
|
errorDescription:NULL];
|
||||||
|
XCTAssertTrue(result, TEST_INFO);
|
||||||
|
NSString *timeString = [secondsFormatter stringForObjectValue:value];
|
||||||
|
XCTAssertEqualObjects(string, timeString, TEST_INFO);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
- (void)testPerformanceExample
|
- (void)testPerformanceExample
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue