Implement -testPositive.

This commit is contained in:
Jan Weiß 2021-05-05 14:59:56 +02:00
parent c020867bce
commit 64fbc7115c

View file

@ -32,6 +32,36 @@
// 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
- (void)testPerformanceExample
{