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.139 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.138 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.137 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.136 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.135 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.134 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.133 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.132 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.131 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.130 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.129 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.128 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.127 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.126 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.125 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.124 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.123 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.122 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.121 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.120 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m