Skip to content

Commit

Permalink
Filter for test/Benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Nov 26, 2023
1 parent 5244003 commit 27579b9
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/Benchmarks/src/Main.enso
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,23 @@ all_benchmarks =

builder.to_vector

main =
benchmarks = all_benchmarks
main filter=Nothing =
benchmarks = if filter.is_nothing then all_benchmarks else
no_nothing x = x.is_nothing.not

filter_benchmarks (b:Bench) = case b of
Bench.All groups ->
vec = groups.map filter_benchmarks . filter no_nothing
if vec.is_empty then Nothing else
Bench.All vec
Bench.Group n opts specs -> if n.contains filter then b else
vec = specs.map filter_benchmarks . filter no_nothing
if vec.is_empty then Nothing else
Bench.Group n opts vec
Bench.Spec n _ -> if n.contains filter then b else Nothing

all_benchmarks.map filter_benchmarks . filter no_nothing

total_specs = benchmarks.map .total_specs . fold 0 (+)
IO.println "Found "+benchmarks.length.to_text+" benchmark suites, containing "+total_specs.to_text+" specs in total."
estimated_duration = benchmarks.map .estimated_runtime . fold Duration.zero (+)
Expand Down

0 comments on commit 27579b9

Please sign in to comment.