Sha256: cd98b34a09c52c593202c5d28a25b510112da8b6e8ba467db3879a41a6e01818

Contents?: true

Size: 865 Bytes

Versions: 78

Compression:

Stored size: 865 Bytes

Contents

#import <XCTest/XCTest.h>

#if __has_include("CollatzConjectureExample.h")
# import "CollatzConjectureExample.h"
# else
# import "CollatzConjecture.h"
#endif

@interface CollatzConjectureTest : XCTestCase

@end

@implementation CollatzConjectureTest

- (void)testZeroStepsForOne {
    XCTAssertEqual(0, [CollatzConjecture stepsForNumber:1]);
}

- (void)testDivideIfEven {
    XCTAssertEqual(4, [CollatzConjecture stepsForNumber:16]);
}

- (void)testEvenAndOddSteps {
    XCTAssertEqual(9, [CollatzConjecture stepsForNumber:12]);
}

- (void)testLargeNumberOfEvenAndOddSteps {
    XCTAssertEqual(152, [CollatzConjecture stepsForNumber:1000000]);
}

- (void)testZeroIsAnError {
    XCTAssertEqual([CollatzConjecture stepsForNumber:0], NSNotFound);
}

- (void)testNegativeValueIsAnError {
    XCTAssertEqual([CollatzConjecture stepsForNumber:-15], NSNotFound);
}

@end

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.179 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.178 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.177 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.176 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.175 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.174 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.173 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.172 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.171 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.170 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.169 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.167 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.166 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.165 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.164 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.163 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.162 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.161 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.160 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m