Configure + run SwiftFormat

This commit is contained in:
Sven Weidauer 2020-12-30 12:53:40 +01:00
parent 7d277a0e43
commit 1f6b55014a
10 changed files with 53 additions and 38 deletions

View file

@ -1,30 +1,29 @@
import XCTest
@testable import LibMakeColors
import XCTest
final class ColorParserTest: XCTestCase {
func testScanningThreeDigitColor() throws {
let scanner = Scanner(string: "#abc")
let color = scanner.color()
XCTAssertEqual(Color(r: 0xaa, g: 0xbb, b: 0xcc), color)
XCTAssertEqual(Color(r: 0xAA, g: 0xBB, b: 0xCC), color)
}
func testScanningFourDigitColor() throws {
let scanner = Scanner(string: "#abcd")
let color = scanner.color()
XCTAssertEqual(Color(r: 0xaa, g: 0xbb, b: 0xcc, a: 0xDD), color)
XCTAssertEqual(Color(r: 0xAA, g: 0xBB, b: 0xCC, a: 0xDD), color)
}
func testScanningSixDigitColor() throws {
let scanner = Scanner(string: "#abcdef")
let color = scanner.color()
XCTAssertEqual(Color(r: 0xab, g: 0xcd, b: 0xef), color)
XCTAssertEqual(Color(r: 0xAB, g: 0xCD, b: 0xEF), color)
}
func testScanningEightDigitColor() throws {
let scanner = Scanner(string: "#abcdef17")
let color = scanner.color()
XCTAssertEqual(Color(r: 0xab, g: 0xcd, b: 0xef, a: 0x17), color)
XCTAssertEqual(Color(r: 0xAB, g: 0xCD, b: 0xEF, a: 0x17), color)
}
func testScanningRGBColor() throws {
@ -38,5 +37,4 @@ final class ColorParserTest: XCTestCase {
let color = scanner.color()
XCTAssertEqual(Color(r: 1, g: 2, b: 3, a: 4), color)
}
}