-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
38 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
app/metro-now/metro-now-tests/getMetroLineColorTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// getMetroLineColorTests.swift | ||
// metro-now-tests | ||
// | ||
// Created by Kryštof Krátký on 15.05.2024. | ||
// | ||
|
||
@testable import metro_now | ||
import SwiftUI | ||
import XCTest | ||
|
||
final class getMetroLineColorTests: XCTestCase { | ||
// MARK: - test if function returns correct color | ||
|
||
/// should show positive and negative or zero seconds without any issues | ||
|
||
func testGetMetroLineColorOutput() { | ||
/// init variables for testing | ||
var lineLetter: String | ||
var result: Color | ||
var expectedResult: Color | ||
|
||
/// test 1 | ||
lineLetter = "A" | ||
result = getMetroLineColor(lineLetter) | ||
expectedResult = Color.green | ||
|
||
XCTAssertEqual(result, expectedResult) | ||
|
||
/// test 2 | ||
lineLetter = "B" | ||
result = getMetroLineColor(lineLetter) | ||
expectedResult = Color.yellow | ||
|
||
XCTAssertEqual(result, expectedResult) | ||
|
||
/// test 3 | ||
lineLetter = "C" | ||
result = getMetroLineColor(lineLetter) | ||
expectedResult = Color.red | ||
|
||
XCTAssertEqual(result, expectedResult) | ||
|
||
/// test 4 | ||
lineLetter = "a" | ||
result = getMetroLineColor(lineLetter) | ||
expectedResult = Color.green | ||
|
||
XCTAssertEqual(result, expectedResult) | ||
|
||
/// test 5 | ||
lineLetter = "b" | ||
result = getMetroLineColor(lineLetter) | ||
expectedResult = Color.yellow | ||
|
||
XCTAssertEqual(result, expectedResult) | ||
|
||
/// test 6 | ||
lineLetter = "c" | ||
result = getMetroLineColor(lineLetter) | ||
expectedResult = Color.red | ||
|
||
XCTAssertEqual(result, expectedResult) | ||
|
||
/// test 7 | ||
/// test if function throws an error | ||
lineLetter = "other" | ||
result = getMetroLineColor(lineLetter) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters