Elm
Versions
0.19
Test Frameworks
Example
The name of the solution module can be anything. Extra module can be provided in preloaded section.
module Example exposing (..)
add : Int -> Int -> Int
add x y = x + ymodule Example exposing (..)
add : Int -> Int -> Int
add x y = x + ymodule ExampleTest exposing (..)
import Expect exposing (Expectation)
import Test exposing (..)
import Example
suite : Test
suite =
describe "Example"
[ test "add" <|
\_ ->
Example.add 1 1
|> Expect.equal 2
]module ExampleTest exposing (..)
import Expect exposing (Expectation)
import Test exposing (..)
import Example
suite : Test
suite =
describe "Example"
[ test "add" <|
\_ ->
Example.add 1 1
|> Expect.equal 2
]Fuzz can be used for property based testing:
module ExampleTest exposing (..)
import Expect exposing (Expectation)
import Test exposing (..)
import Fuzz
import Example
suite : Test
suite =
describe "Example"
[ fuzz2 Fuzz.int Fuzz.int "add" <|
\a b ->
Example.add a b
|> Expect.equal (a + b)
]module ExampleTest exposing (..)
import Expect exposing (Expectation)
import Test exposing (..)
import Fuzz
import Example
suite : Test
suite =
describe "Example"
[ fuzz2 Fuzz.int Fuzz.int "add" <|
\a b ->
Example.add a b
|> Expect.equal (a + b)
]Timeout
12 seconds
Packages
elm/coreelm-community/array-extraelm-community/basics-extraelm-community/dict-extraelm-community/list-extraelm-community/maybe-extraelm-community/random-extraelm-community/string-extraelm-explorations/test
Services
None
Language ID
elm