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.119 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.118 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.117 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.116 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.115 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.114 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.113 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.111 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.110 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.109 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.108 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.107 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.106 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.105 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.104 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.103 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.102 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.101 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m