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.159 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.158 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.157 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.156 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.155 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.154 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.153 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.152 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.151 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.150 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.149 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.148 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.147 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.146 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.145 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.144 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.143 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.142 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.141 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m
trackler-2.2.1.140 tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m