|
| 1 | +module Tests exposing (tests) |
| 2 | + |
| 3 | +import Expect |
| 4 | +import ResistorColorTrio exposing (Color(..), label) |
| 5 | +import Test exposing (Test, describe, skip, test) |
| 6 | + |
| 7 | + |
| 8 | +tests : Test |
| 9 | +tests = |
| 10 | + describe "ResistorColorTrio" |
| 11 | + [ test "Orange and orange and black" <| |
| 12 | + \() -> |
| 13 | + ResistorColorTrio.label [ Orange, Orange, Black ] |
| 14 | + |> Expect.equal "33 ohms" |
| 15 | + , skip <| |
| 16 | + test "Blue and grey and brown" <| |
| 17 | + \() -> |
| 18 | + ResistorColorTrio.label [ Blue, Grey, Brown ] |
| 19 | + |> Expect.equal "680 ohms" |
| 20 | + , skip <| |
| 21 | + test "Red and black and red" <| |
| 22 | + \() -> |
| 23 | + ResistorColorTrio.label [ Red, Black, Red ] |
| 24 | + |> Expect.equal "2 kiloohms" |
| 25 | + , skip <| |
| 26 | + test "Green and brown and orange" <| |
| 27 | + \() -> |
| 28 | + ResistorColorTrio.label [ Green, Brown, Orange ] |
| 29 | + |> Expect.equal "51 kiloohms" |
| 30 | + , skip <| |
| 31 | + test "Yellow and violet and yellow" <| |
| 32 | + \() -> |
| 33 | + ResistorColorTrio.label [ Yellow, Violet, Yellow ] |
| 34 | + |> Expect.equal "470 kiloohms" |
| 35 | + , skip <| |
| 36 | + test "Blue and violet and blue" <| |
| 37 | + \() -> |
| 38 | + ResistorColorTrio.label [ Blue, Violet, Blue ] |
| 39 | + |> Expect.equal "67 megaohms" |
| 40 | + , skip <| |
| 41 | + test "Minimum possible value" <| |
| 42 | + \() -> |
| 43 | + ResistorColorTrio.label [ Black, Black, Black ] |
| 44 | + |> Expect.equal "0 ohms" |
| 45 | + , skip <| |
| 46 | + test "Maximum possible value" <| |
| 47 | + \() -> |
| 48 | + ResistorColorTrio.label [ White, White, White ] |
| 49 | + |> Expect.equal "99 gigaohms" |
| 50 | + , skip <| |
| 51 | + test "First two colors make an invalid octal number" <| |
| 52 | + \() -> |
| 53 | + ResistorColorTrio.label [ Black, Grey, Black ] |
| 54 | + |> Expect.equal "8 ohms" |
| 55 | + , skip <| |
| 56 | + test "Ignore extra colors" <| |
| 57 | + \() -> |
| 58 | + ResistorColorTrio.label [ Blue, Green, Yellow, Orange ] |
| 59 | + |> Expect.equal "650 kiloohms" |
| 60 | + ] |
0 commit comments