Class: Hegel::Runner::GenerationStats
- Inherits:
-
Object
- Object
- Hegel::Runner::GenerationStats
- Defined in:
- lib/hegel/runner.rb,
sig/hegel.rbs
Overview
Counts test cases as #drive receives them from the live run loop, and snapshots, per distinct origin, how many had been returned (and how many of those were discarded) the first time that origin's exception was classified INTERESTING. That snapshot is the failure report's own "Falsified after N test cases (M discarded)" line: the generation phase's counts, not the shrink phase's -- #drive's own comment measured the shrink phase at roughly 50x more iterations for a similarly sized run, and counting those into N would answer a different question than the report claims to.
Instance Method Summary collapse
-
#for(origin) ⇒ [Integer, Integer]
[test_cases, discarded] as of +origin+'s first INTERESTING appearance.
-
#initialize ⇒ GenerationStats
constructor
A new instance of GenerationStats.
-
#record(status, origin) ⇒ void
Called once per case #drive receives (or, from #reproduce, exactly once for its own single case).
Constructor Details
#initialize ⇒ GenerationStats
Returns a new instance of GenerationStats.
70 71 72 73 74 |
# File 'lib/hegel/runner.rb', line 70 def initialize @test_cases = 0 @discarded = 0 @snapshots = {} end |
Instance Method Details
#for(origin) ⇒ [Integer, Integer]
[test_cases, discarded] as of +origin+'s first INTERESTING appearance. No fallback: every origin #replay_failure asks for here came from a failure hegel_run_result reported, and that failure exists only because this same #record already saw it live.
88 89 90 |
# File 'lib/hegel/runner.rb', line 88 def for(origin) @snapshots.fetch(origin) end |
#record(status, origin) ⇒ void
This method returns an undefined value.
Called once per case #drive receives (or, from #reproduce, exactly once for its own single case).
78 79 80 81 82 |
# File 'lib/hegel/runner.rb', line 78 def record(status, origin) @test_cases += 1 @discarded += 1 if status == LibHegel::HEGEL_STATUS_INVALID @snapshots[origin] ||= [@test_cases, @discarded] if status == LibHegel::HEGEL_STATUS_INTERESTING end |