Sha256: bd49f169b93c871fec4bfc2f3d39828b48cf84c6b3f37f1e74e337f406acac75

Contents?: true

Size: 1.64 KB

Versions: 68

Compression:

Stored size: 1.64 KB

Contents

#import <XCTest/XCTest.h>

#if __has_include("PrimeFactorsExample.h")
#import "PrimeFactorsExample.h"
#else
#import "PrimeFactors.h"
#endif

@interface PrimeFactorsTest : XCTestCase

@end

@implementation PrimeFactorsTest

- (void)test1 {
    XCTAssertEqualObjects(@[], [PrimeFactors factorsForInteger:1]);
}

- (void)test2 {
    XCTAssertEqualObjects(@[@2], [PrimeFactors factorsForInteger:2]);
}

- (void)test3 {
    XCTAssertEqualObjects(@[@3], [PrimeFactors factorsForInteger:3]);
}

- (void)test4 {
    NSArray<NSNumber *> *expected = @[@2, @2];
    XCTAssertEqualObjects(expected, [PrimeFactors factorsForInteger:4]);
}

- (void)test6 {
    NSArray<NSNumber *> *expected = @[@2, @3];
    XCTAssertEqualObjects(expected, [PrimeFactors factorsForInteger:6]);
}

- (void)test8 {
    NSArray<NSNumber *> *expected = @[@2, @2, @2];
    XCTAssertEqualObjects(expected, [PrimeFactors factorsForInteger:8]);
}

- (void)test9 {
    NSArray<NSNumber *> *expected = @[@3, @3];
    XCTAssertEqualObjects(expected, [PrimeFactors factorsForInteger:9]);
}

- (void)test27 {
    NSArray<NSNumber *> *expected = @[@3, @3, @3];
    XCTAssertEqualObjects(expected, [PrimeFactors factorsForInteger:27]);
}

- (void)test625 {
    NSArray<NSNumber *> *expected = @[@5, @5, @5, @5];
    XCTAssertEqualObjects(expected, [PrimeFactors factorsForInteger:625]);
}

- (void)test901255 {
    NSArray<NSNumber *> *expected = @[@5, @17, @23, @461];
    XCTAssertEqualObjects(expected, [PrimeFactors factorsForInteger:901255]);
}

- (void)test93819012551 {
    NSArray<NSNumber *> *expected = @[@11, @9539, @894119];
    XCTAssertEqualObjects(expected, [PrimeFactors factorsForInteger:93819012551]);
}

@end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.138 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.137 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.136 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.135 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.134 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.133 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.132 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.131 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.130 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.129 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.128 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.127 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.126 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.125 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.124 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.123 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.122 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.121 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m
trackler-2.2.1.120 tracks/objective-c/exercises/prime-factors/PrimeFactorsTest.m