Sha256: 77e59f21a426c9f70f0b452e132bf24156a9cefe154701285e934ab5eb0150a3

Contents?: true

Size: 1.63 KB

Versions: 141

Compression:

Stored size: 1.63 KB

Contents

port module Main exposing (..)

import Test.Runner.Node exposing (run, TestProgram)
import Json.Encode exposing (Value)
import Test exposing (..)
import Expect
import DifferenceOfSquares exposing (squareOfSum, sumOfSquares, difference)


tests : Test
tests =
    describe "DifferenceOfSquares"
        [ describe "square the sum of the numbers up to the given number"
            [ test "square of sum 5" <|
                \() -> Expect.equal 225 (squareOfSum 5)
            , test "square of sum 10" <|
                \() -> Expect.equal 3025 (squareOfSum 10)
            , test "square of sum 100" <|
                \() -> Expect.equal 25502500 (squareOfSum 100)
            ]
        , describe "sum the squares of the numbers up to the given number"
            [ test "sum of squares 5" <|
                \() -> Expect.equal 55 (sumOfSquares 5)
            , test "sum of squares 10" <|
                \() -> Expect.equal 385 (sumOfSquares 10)
            , test "sum of squares 100" <|
                \() -> Expect.equal 338350 (sumOfSquares 100)
            ]
        , describe "subtract sum of squares from square of sums"
            [ test "difference of squares 0" <|
                \() -> Expect.equal 0 (difference 0)
            , test "difference of squares 5" <|
                \() -> Expect.equal 170 (difference 5)
            , test "difference of squares 10" <|
                \() -> Expect.equal 2640 (difference 10)
            , test "difference of squares 100" <|
                \() -> Expect.equal 25164150 (difference 100)
            ]
        ]


main : TestProgram
main =
    run emit tests


port emit : ( String, Value ) -> Cmd msg

Version data entries

141 entries across 141 versions & 1 rubygems

Version Path
trackler-2.1.0.23 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.22 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.21 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.20 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.19 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.18 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.17 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.16 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.15 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.14 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.13 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.12 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.11 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.10 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.9 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.8 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.7 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.6 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.5 tracks/elm/exercises/difference-of-squares/Tests.elm
trackler-2.1.0.4 tracks/elm/exercises/difference-of-squares/Tests.elm