Sha256: 4ee1e7ac2c7781dc4894470d79306375a82ac16d3e359d214b81988d8d9212fa

Contents?: true

Size: 1.97 KB

Versions: 396

Compression:

Stored size: 1.97 KB

Contents

#import <XCTest/XCTest.h>

#if __has_include("TriangleExample.h")
# import "TriangleExample.h"
# else
# import "Triangle.h"
#endif

@interface TriangleTest : XCTestCase

@end

@implementation TriangleTest

- (void)testEquilateralTrianglesHaveEqualSides {
    XCTAssertEqual(TriangleKindEquilateral, [Triangle kindForSides:2 :2 :2]);
}

- (void)testLargerEquilateralTrianglesAlsoHaveEqualSides {
    XCTAssertEqual(TriangleKindEquilateral, [Triangle kindForSides:10 :10 :10]);
}

- (void)testIsoscelesTrianglesHaveLastTwoSidesEqual {
    XCTAssertEqual(TriangleKindIsosceles, [Triangle kindForSides:3 :4 :4]);
}

- (void)testIsoscelesTrianglesHaveFirstAndLastSidesEqual {
    XCTAssertEqual(TriangleKindIsosceles, [Triangle kindForSides:4 :3 :4]);
}

- (void)testIsoscelesTrianglesHaveTwoFirstSidesEqual {
    XCTAssertEqual(TriangleKindIsosceles, [Triangle kindForSides:4 :4 :3]);
}

- (void)testIsoscelesTrianglesHaveInFactExactlyTwoSidesEqual {
    XCTAssertEqual(TriangleKindIsosceles, [Triangle kindForSides:10 :10 :2]);
}

- (void)testScaleneTrianglesHaveNoEqualSides {
    XCTAssertEqual(TriangleKindScalene, [Triangle kindForSides:3 :4 :5]);
}

- (void)testScaleneTrianglesHaveNoEqualSidesAtALargerScaleToo {
    XCTAssertEqual(TriangleKindScalene, [Triangle kindForSides:10 :11 :12]);
}

- (void)testScaleneTrianglesHaveNoEqualSidesInDescendingOrderEither {
    XCTAssertEqual(TriangleKindScalene, [Triangle kindForSides:5 :4 :2]);
}

- (void)testVerySmallTrianglesAreLegal {
    XCTAssertEqual(TriangleKindScalene, [Triangle kindForSides:0.4 :0.6 :0.3]);
}

- (void)testTrianglesWithNoSizeAreIllegal {
    XCTAssertThrows([Triangle kindForSides:0 :0 :0]);
}

- (void)testTrianglesWithNegativeSidesAreIllegal {
    XCTAssertThrows([Triangle kindForSides:3 :4 :-5]);
}

- (void)testTrianglesViolatingTriangleInequalityAreIllegal {
    XCTAssertThrows([Triangle kindForSides:1 :1 :3]);
}

- (void)testTrianglesViolatingTriangleInequalityAreIllegal3 {
    XCTAssertThrows([Triangle kindForSides:7 :3 :2]);
}

@end

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.97 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.96 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.95 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.94 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.93 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.92 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.91 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.90 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.89 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.88 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.87 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.86 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.85 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.84 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.83 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.82 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.81 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.80 tracks/objective-c/exercises/triangle/TriangleTest.m
trackler-2.2.1.79 tracks/objective-c/exercises/triangle/TriangleTest.m