Class: Bparity::Verification::TraceReplay

Inherits:
Object
  • Object
show all
Defined in:
lib/bparity/verification.rb

Instance Method Summary collapse

Constructor Details

#initialize(bundle:, adapter:, mode: nil) ⇒ TraceReplay

Returns a new instance of TraceReplay.



108
109
110
111
112
113
114
115
116
117
118
# File 'lib/bparity/verification.rb', line 108

def initialize(bundle:, adapter:, mode: nil)
  @bundle = bundle
  @adapter = adapter
  @canonicalization = bundle.fetch("canonicalization", {}).transform_keys(&:to_sym)
  @canonicalizer = Recording::Canonicalizer.new(@canonicalization)
  @comparator = Comparator.new(mode: mode || bundle.fetch("conformance_mode", "refinement"),
                               float_tolerance: @canonicalization.fetch(:float_tolerance, Float::EPSILON))
  @refinement_comparator = Comparator.new(mode: :refinement)
  @contract_checker = Formal::ContractChecker.new
  @external_probe = ExternalProbe.new(adapter.externals).install!
end

Instance Method Details

#runObject



120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/bparity/verification.rb', line 120

def run
  Recording::Determinism.apply(@canonicalization)
  results = @bundle.fetch("subjects").flat_map { |subject| replay_subject(subject) }
  unused = @adapter.waivers.keys - results.map(&:id)
  unless unused.empty?
    raise ConfigurationError,
          "Waiver IDs were not found in the Spec Bundle: #{unused.join(', ')}. Remove or correct them."
  end
  results
ensure
  Recording::Determinism.clear
end