Skip to content

Commit 0128d44

Browse files
committed
Upgrade benchmarks to 0.19
1 parent 0cff1e8 commit 0128d44

5 files changed

Lines changed: 41 additions & 78 deletions

File tree

benchmarks/Main.elm

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Main exposing (main)
33
import Benchmark exposing (..)
44
import Benchmark.Runner as Runner
55
import Expect exposing (Expectation)
6-
import Random.Pcg
6+
import Random
77
import Snippets
88
import Test.Internal exposing (Test(..))
99

@@ -64,25 +64,17 @@ suite =
6464
[ benchmark "generating" (benchTest Snippets.map5Pass)
6565
, benchmark "simplifying" (benchTest Snippets.map5Fail)
6666
]
67-
, describe "andThen"
68-
[ benchmark "generating" (benchTest Snippets.andThenPass)
69-
, benchmark "simplifying" (benchTest Snippets.andThenFail)
70-
]
71-
, describe "conditional"
72-
[ benchmark "generating" (benchTest Snippets.conditionalPass)
73-
, benchmark "simplifying" (benchTest Snippets.conditionalFail)
74-
]
7567
]
7668

7769

7870
benchTest : Test -> (() -> List Expectation)
7971
benchTest test =
8072
case test of
81-
Test fn ->
82-
\_ -> fn (Random.Pcg.initialSeed 0) 10
73+
ElmTestVariant__FuzzTest fn ->
74+
\_ -> fn (Random.initialSeed 0) 10
8375

84-
Labeled _ test ->
85-
benchTest test
76+
ElmTestVariant__Labeled _ test_ ->
77+
benchTest test_
8678

87-
test ->
88-
Debug.crash <| "No support for benchmarking this type of test: " ++ toString test
79+
test_ ->
80+
Debug.todo <| "No support for benchmarking this type of test: " ++ Debug.toString test_

benchmarks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ These are some benchmarks of the elm-test library built using the excellent [elm
66

77
```sh
88
cd ./benchmarks
9-
elm-make Main.elm
9+
elm make Main.elm
1010
open index.html
1111
```
1212

benchmarks/Snippets.elm

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Snippets exposing (Person, andMapFail, andMapPass, andThenFail, andThenPass, boolFail, boolPass, charFail, charPass, conditionalFail, conditionalPass, even, evenWithConditional, floatFail, floatPass, intFail, intPass, intRangeFail, intRangePass, listIntFail, listIntPass, map5Fail, map5Pass, mapFail, mapPass, maybeIntFail, maybeIntPass, person, person2, resultFail, resultPass, sequence, stringFail, stringPass, variableList)
1+
module Snippets exposing (..)
22

33
import Expect exposing (Expectation)
44
import Fuzz exposing (Fuzzer)
@@ -169,30 +169,6 @@ map5Fail =
169169
\_ -> Expect.fail "Failed"
170170

171171

172-
andThenPass : Test
173-
andThenPass =
174-
fuzz (variableList 2 5 Fuzz.int) "(passes) andThen" <|
175-
\_ -> Expect.pass
176-
177-
178-
andThenFail : Test
179-
andThenFail =
180-
fuzz (variableList 2 5 Fuzz.int) "(fails) andThen" <|
181-
\_ -> Expect.fail "Failed"
182-
183-
184-
conditionalPass : Test
185-
conditionalPass =
186-
fuzz evenWithConditional "(passes) conditional" <|
187-
\_ -> Expect.pass
188-
189-
190-
conditionalFail : Test
191-
conditionalFail =
192-
fuzz evenWithConditional "(fails) conditional" <|
193-
\_ -> Expect.fail "Failed"
194-
195-
196172
type alias Person =
197173
{ firstName : String
198174
, lastName : String
@@ -226,25 +202,9 @@ even =
226202
Fuzz.map ((*) 2) Fuzz.int
227203

228204

229-
variableList : Int -> Int -> Fuzzer a -> Fuzzer (List a)
230-
variableList min max item =
231-
Fuzz.intRange min max
232-
|> Fuzz.andThen (\length -> List.repeat length item |> sequence)
233-
234-
235205
sequence : List (Fuzzer a) -> Fuzzer (List a)
236206
sequence fuzzers =
237207
List.foldl
238208
(Fuzz.map2 (::))
239209
(Fuzz.constant [])
240210
fuzzers
241-
242-
243-
evenWithConditional : Fuzzer Int
244-
evenWithConditional =
245-
Fuzz.intRange 1 6
246-
|> Fuzz.conditional
247-
{ retries = 3
248-
, fallback = (+) 1
249-
, condition = \n -> (n % 2) == 0
250-
}

benchmarks/elm-package.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

benchmarks/elm.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"type": "application",
3+
"source-directories": [
4+
".",
5+
"../src"
6+
],
7+
"elm-version": "0.19.1",
8+
"dependencies": {
9+
"direct": {
10+
"elm/bytes": "1.0.8",
11+
"elm/core": "1.0.5",
12+
"elm/html": "1.0.0",
13+
"elm/json": "1.1.3",
14+
"elm/random": "1.0.0",
15+
"elm-explorations/benchmark": "1.0.2"
16+
},
17+
"indirect": {
18+
"BrianHicks/elm-trend": "2.1.3",
19+
"elm/browser": "1.0.2",
20+
"elm/regex": "1.0.0",
21+
"elm/time": "1.0.0",
22+
"elm/url": "1.0.0",
23+
"elm/virtual-dom": "1.0.2",
24+
"mdgriffith/style-elements": "5.0.2",
25+
"robinheghan/murmur3": "1.0.0"
26+
}
27+
},
28+
"test-dependencies": {
29+
"direct": {},
30+
"indirect": {}
31+
}
32+
}

0 commit comments

Comments
 (0)