DEV Community

Discussion on: Daily Challenge #87 - Pony Express

Collapse
 
aminnairi profile image
Amin

Elm

module PonyExpress exposing (riders)


riders : List Int -> Int
riders stations =
    ceiling <| toFloat (List.sum stations) / 100

Tests

module PonyExpressTest exposing (suite)

import Expect exposing (equal)
import PonyExpress exposing (riders)
import Test exposing (Test, describe, test)


suite : Test
suite =
    describe "Pony express"
        [ test "It should return 2 for a total ride of 119 miles" <|
            \_ -> equal 2 <| riders [ 43, 23, 40, 13 ]
        , test "It should return 1 for a total ride of 100 miles" <|
            \_ -> equal 1 <| riders [ 43, 23, 34 ]
        , test "It should return 0 for a total ride of 0 miles" <|
            \_ -> equal 0 <| riders [ 0 ]
        ]

Playground

Hosted here on Ellie App.