mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-11-25 22:50:42 +03:00
add arity testcase
This commit is contained in:
parent
1c9f37c6f4
commit
569f63cfa1
46
testcases/arityexplorer/Main.elm
Normal file
46
testcases/arityexplorer/Main.elm
Normal file
@ -0,0 +1,46 @@
|
||||
port module Main exposing (main)
|
||||
|
||||
{-| -}
|
||||
|
||||
import Benchmark exposing (..)
|
||||
import Benchmark.Runner exposing (BenchmarkProgram, program)
|
||||
import Benchmark.Runner.Json
|
||||
import Dict
|
||||
import Html
|
||||
import Json.Decode
|
||||
import Json.Encode
|
||||
import List
|
||||
|
||||
|
||||
main : Benchmark.Runner.Json.JsonBenchmark
|
||||
main =
|
||||
Benchmark.Runner.Json.program reportResults suite
|
||||
|
||||
|
||||
port reportResults : Json.Encode.Value -> Cmd msg
|
||||
|
||||
|
||||
type MyType
|
||||
= Zero
|
||||
| One Int
|
||||
| Two String String
|
||||
|
||||
|
||||
{-| This is an interesting case becase the function be being applied both fully, and partially.
|
||||
-}
|
||||
weird : (Bool -> MyType -> Bool) -> ( MyType, List MyType ) -> List Bool
|
||||
weird fn ( top, remaining ) =
|
||||
fn True top :: List.map (fn False) remaining
|
||||
|
||||
|
||||
alwaysFalse one two =
|
||||
False
|
||||
|
||||
|
||||
suite : Benchmark
|
||||
suite =
|
||||
describe "Arity"
|
||||
[ benchmark "Passed function being used fully and partially" <|
|
||||
\_ ->
|
||||
weird alwaysFalse ( Zero, [ Zero, Zero, Zero ] )
|
||||
]
|
30
testcases/arityexplorer/elm.json
Normal file
30
testcases/arityexplorer/elm.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"type": "application",
|
||||
"source-directories": [
|
||||
".",
|
||||
"../benchmark-utilities"
|
||||
],
|
||||
"elm-version": "0.19.1",
|
||||
"dependencies": {
|
||||
"direct": {
|
||||
"BrianHicks/elm-trend": "2.1.3",
|
||||
"elm/browser": "1.0.2",
|
||||
"elm/core": "1.0.5",
|
||||
"elm/html": "1.0.0",
|
||||
"elm/json": "1.1.3",
|
||||
"elm-explorations/benchmark": "1.0.1"
|
||||
},
|
||||
"indirect": {
|
||||
"Skinney/murmur3": "2.0.8",
|
||||
"elm/regex": "1.0.0",
|
||||
"elm/time": "1.0.0",
|
||||
"elm/url": "1.0.0",
|
||||
"elm/virtual-dom": "1.0.2",
|
||||
"mdgriffith/style-elements": "5.0.1"
|
||||
}
|
||||
},
|
||||
"test-dependencies": {
|
||||
"direct": {},
|
||||
"indirect": {}
|
||||
}
|
||||
}
|
0
testcases/arityexplorer/output/.keep
Normal file
0
testcases/arityexplorer/output/.keep
Normal file
22
testcases/arityexplorer/standard.html
Normal file
22
testcases/arityexplorer/standard.html
Normal file
@ -0,0 +1,22 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Main</title>
|
||||
<script src="output/elm.opt.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="myapp"></div>
|
||||
<script>
|
||||
var app = Elm.Main.init({
|
||||
node: document.getElementById('myapp'),
|
||||
});
|
||||
|
||||
window.results = [];
|
||||
app.ports.reportResults.subscribe(function(message) {
|
||||
window.results = message;
|
||||
document.title = 'done';
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
21
testcases/arityexplorer/transformed.html
Normal file
21
testcases/arityexplorer/transformed.html
Normal file
@ -0,0 +1,21 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Main</title>
|
||||
<script src="output/elm.opt.transformed.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="myapp"></div>
|
||||
<script>
|
||||
var app = Elm.Main.init({
|
||||
node: document.getElementById('myapp'),
|
||||
});
|
||||
window.results = [];
|
||||
app.ports.reportResults.subscribe(function(message) {
|
||||
window.results = message;
|
||||
document.title = 'done';
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user