From 011eddc23a88b78396f44b2bbdfec19fd7d817e5 Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Sun, 14 Jan 2024 22:39:23 +0200 Subject: [PATCH] Update tests --- .../IceCreamSandwichTests.swift | 53 +++++++++++++++---- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/Tests/IceCreamSandwichTests/IceCreamSandwichTests.swift b/Tests/IceCreamSandwichTests/IceCreamSandwichTests.swift index df2f334..5fe4d35 100644 --- a/Tests/IceCreamSandwichTests/IceCreamSandwichTests.swift +++ b/Tests/IceCreamSandwichTests/IceCreamSandwichTests.swift @@ -7,20 +7,53 @@ import XCTest @testable import IceCreamSandwich final class IcecreamSandwichTests: XCTestCase { - func testValidIcecreamSandwich() { - XCTAssertTrue("CDC".isIceCreamSandwich) - XCTAssertTrue("AABBBAA".isIceCreamSandwich) - XCTAssertTrue("3&&3".isIceCreamSandwich) + func testStringIceCreamSandwich() { + XCTAssertTrue("AABBA".isIceCreamSandwich) + } + + func testArrayIceCreamSandwich() { + XCTAssertTrue([1, 2, 2, 1].isIceCreamSandwich) + } + + func testBoolArrayIceCreamSandwich() { + XCTAssertTrue([true, true, false, true, true].isIceCreamSandwich) + } + + func testStringNotIceCreamSandwich() { + XCTAssertFalse("ABBA".isIceCreamSandwich) + } + + func testArrayNotIceCreamSandwich() { + XCTAssertFalse([1, 2, 3, 1].isIceCreamSandwich) + } + + func testBoolArrayNotIceCreamSandwich() { + XCTAssertFalse([false, true, false].isIceCreamSandwich) + } + + func testTooShortCollection() { + XCTAssertFalse("AA".isIceCreamSandwich) + } + + func testIntegerIceCreamSandwich() { + XCTAssertTrue(11211.isIceCreamSandwich) + } + + func testAnotherIntegerIceCreamSandwich() { + XCTAssertTrue(1221.isIceCreamSandwich) } - func testInvalidIcecreamSandwich() { - XCTAssertFalse("BBBBB".isIceCreamSandwich) - XCTAssertFalse("AAACCCAA".isIceCreamSandwich) - XCTAssertFalse("AACDCAA".isIceCreamSandwich) - XCTAssertFalse("A".isIceCreamSandwich) + func testIntegerNotIceCreamSandwich() { + XCTAssertFalse(121.isIceCreamSandwich) + } + + func testAnotherIntegerNotIceCreamSandwich() { + XCTAssertFalse(1231.isIceCreamSandwich) } - func testEmptyString() { + func testEmptyCollection() { XCTAssertFalse("".isIceCreamSandwich) + XCTAssertFalse([Int]().isIceCreamSandwich) + XCTAssertFalse([Bool]().isIceCreamSandwich) } }