Skip to content

Commit

Permalink
Base test coverage has beed added
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyrylo Zharenkov authored and Kyrylo Zharenkov committed Mar 6, 2020
1 parent 0b7882f commit b5a028b
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions UnitTests/UnitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import XCTest
@testable import ColorUtils

class ColorUtilsTestSuite: XCTestCase {

func testRGBAInit() {
let rgba = ColorRGBA(r: 43, g: 255, b: 255, a: 255)

Expand All @@ -27,5 +27,27 @@ class ColorUtilsTestSuite: XCTestCase {
XCTAssertEqual(0.2, hsl.s)
XCTAssertEqual(0.1, hsl.l)
}


func testConvertFromRgbaToHsl() {

let rgba = ColorRGBA(r: 47, g: 25, b: 123, a: 255)
let hsl = convertToHSL(rgba: rgba)

XCTAssertEqual(0.7040816326530613, hsl.h)
XCTAssertEqual(0.6621621621621622, hsl.s)
XCTAssertEqual(0.2901960784313726, hsl.l)
}

func testConvertFromHslToRgba() {
let hsl = ColorHSL(h: 0.7040816326530613, s: 0.6621621621621622, l: 0.2901960784313726)

let rgba = convertToRGBA(hsl: hsl)

XCTAssertEqual(47, rgba.r)
XCTAssertEqual(24, rgba.g)
XCTAssertEqual(123, rgba.b)
XCTAssertEqual(255, rgba.a)

}

}

0 comments on commit b5a028b

Please sign in to comment.