souplesse/frontend/tests/LibTest.elm
Daniel Barlow 40af75c140 nice-numbers: remove hardcoded values for rounding
in preparation for paramatrising digits-that-are-nice, compute
the boundaries between one number and the next
2024-11-17 00:19:39 +00:00

36 lines
1.0 KiB
Elm

module LibTest exposing (specs)
import Lib exposing (..)
import Test exposing (..)
import Expect exposing (Expectation)
specs: Test
specs =
describe "looseLabels"
[ test "0-100" <|
\_ ->
let (u, v, _) = looseLabels 10 0.0 100.0
in Expect.equal (0, 100) (u, v)
, test "2-98" <|
\_ ->
let (u, v, _) = looseLabels 10 2 98
in Expect.equal (0, 100) (u, v)
, test "8-91" <|
\_ ->
let (u, v, _) = looseLabels 10 8 91
in Expect.equal (0, 100) (u, v)
, test "1-32" <|
\_ ->
let (u, v, _) = looseLabels 8 1 32
in Expect.equal (0, 35) (u, v)
, test "1-36" <|
\_ ->
let (u, v, _) = looseLabels 8 1 36
in Expect.equal (0, 40) (u, v)
, test "1-4" <|
\_ ->
let (u, v, _) = looseLabels 10 1 4
in Expect.equal (1, 4) (u, v)
]