shard-spectator/src/spectator/test_results.cr

28 lines
529 B
Crystal
Raw Normal View History

2018-08-31 05:38:20 +00:00
module Spectator
2018-09-15 19:31:55 +00:00
class TestResults
2018-08-31 05:38:20 +00:00
getter runtime : Time::Span
2018-09-15 19:25:11 +00:00
@results : Array(Result)
2018-08-31 05:38:20 +00:00
2018-09-15 19:25:11 +00:00
def initialize(results : Enumerable(Result), @runtime)
2018-08-31 05:38:20 +00:00
@results = results.to_a
end
def successful_examples
@results.select { |result| result.successful? }
end
def failed_examples
@results.select { |result| result.failed? }
end
def example_runtime
@results.map { |result| result.elapsed }.sum
end
def overhead_time
@runtime - example_runtime
end
end
end