Class: Bparity::Formal::DifferentialRunner

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

Instance Method Summary collapse

Constructor Details

#initialize(old_command:, new_command:, inputs:) ⇒ DifferentialRunner

Returns a new instance of DifferentialRunner.



508
509
510
511
512
# File 'lib/bparity/formal/bounded.rb', line 508

def initialize(old_command:, new_command:, inputs:)
  @old_command = old_command
  @new_command = new_command
  @inputs = inputs
end

Instance Method Details

#runObject



514
515
516
517
518
519
520
521
522
523
524
# File 'lib/bparity/formal/bounded.rb', line 514

def run
  @inputs.filter_map do |input|
    expected = observe(@old_command, input)
    actual = observe(@new_command, input)
    differences = Verification::Differ.call(expected, actual)
    unless differences.empty?
      { "input" => input, "expected" => expected, "actual" => actual,
        "differences" => differences }
    end
  end
end