Last active
November 21, 2016 19:43
-
-
Save rogeriochaves/0469293114163b23d889 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Tests exposing (..) | |
import Test exposing (..) | |
import Expect exposing (..) | |
import Fuzz exposing (list, int, tuple, string) | |
import String | |
import ElmTestBDDStyle exposing (..) | |
all : Test | |
all = | |
describe "Sample Test Suite" | |
[ describe "Unit test examples" | |
[ it "can add things" <| | |
expect (3 + 7) to equal 10 | |
, it "gets the first letter" <| | |
expect "a" to equal (String.left 1 "abcdefg") | |
, it "fails - you should remove it" <| | |
fail "Failed as expected!" | |
] | |
, describe "Fuzz test examples, using randomly generated input" | |
[ fuzz (list int) "Lists always have positive length" <| | |
\aList -> | |
expect (List.length aList) toBe atLeast 0 | |
, fuzz (list int) "Sorting a list does not change its length" <| | |
\aList -> | |
expect (List.sort aList |> List.length) to equal (List.length aList) | |
, fuzzWith { runs = 1000 } int "List.member will find an integer in a list containing it" <| | |
\i -> | |
expect (List.member i [ i ]) toBe true "If you see this, List.member returned False!" | |
, fuzz2 string string "The length of a string equals the sum of its substrings' lengths" <| | |
\s1 s2 -> | |
expect (s1 ++ s2 |> String.length) to equal (String.length s1 + String.length s2) | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment