Sha256: 3f5baa66667c517ccef04051d9eab99a0f5ed39cbada4eb213fe2428705b647b

Contents?: true

Size: 1.8 KB

Versions: 396

Compression:

Stored size: 1.8 KB

Contents

#import <XCTest/XCTest.h>

#if __has_include("SumOfMultiplesExample.h")
# import "SumOfMultiplesExample.h"
# else
# import "SumOfMultiples.h"
#endif

@interface SumOfMultiplesTest : XCTestCase

@end

@implementation SumOfMultiplesTest

- (void)testSumTo1 {
    NSNumber *sum = [SumOfMultiples toLimit:@1 inMultiples:@[@3, @5]];
    XCTAssertEqualObjects(@0, sum);
}

- (void)testSumTo3 {
    NSNumber *sum = [SumOfMultiples toLimit:@4 inMultiples:@[@3, @5]];
    XCTAssertEqualObjects(@3, sum);
}

- (void)testSumTo10 {
    NSNumber *sum = [SumOfMultiples toLimit:@10 inMultiples:@[@3, @5]];
    XCTAssertEqualObjects(@23, sum);
}

- (void)testSumTo100 {
    NSNumber *sum = [SumOfMultiples toLimit:@100 inMultiples:@[@3, @5]];
    XCTAssertEqualObjects(@2318, sum);
}

- (void)testSumTo1000 {
    NSNumber *sum = [SumOfMultiples toLimit:@1000 inMultiples:@[@3, @5]];
    XCTAssertEqualObjects(@233168, sum);
}

- (void)testConfigurable_7_13_17_to_20 {
    NSNumber *sum = [SumOfMultiples toLimit:@20 inMultiples:@[@7, @13, @17]];
    XCTAssertEqualObjects(@51, sum);
}

- (void)testConfigurable_4_6_to_15 {
    NSNumber *sum = [SumOfMultiples toLimit:@15 inMultiples:@[@4, @6]];
    XCTAssertEqualObjects(@30, sum);
}

- (void)testConfigurable_5_6_8_to_150 {
    NSNumber *sum = [SumOfMultiples toLimit:@150 inMultiples:@[@5, @6, @8]];
    XCTAssertEqualObjects(@4419, sum);
}

- (void)testConfigurable_43_47_to_10000 {
    NSNumber *sum = [SumOfMultiples toLimit:@10000 inMultiples:@[@43, @47]];
    XCTAssertEqualObjects(@2203160, sum);
}

- (void)testConfigurable_0_to_10 {
    NSNumber *sum = [SumOfMultiples toLimit:@10 inMultiples:@[@0]];
    XCTAssertEqualObjects(@0, sum);
}

- (void)testConfigurable_0_1_to_10 {
    NSNumber *sum = [SumOfMultiples toLimit:@10 inMultiples:@[@0, @1]];
    XCTAssertEqualObjects(@45, sum);
}

@end

Version data entries

396 entries across 396 versions & 1 rubygems

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