Class: DecisionAgent::Testing::ComparisonResult

Inherits:
Object
  • Object
show all
Defined in:
lib/decision_agent/testing/test_result_comparator.rb

Overview

Comparison result for a single test scenario

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scenario_id:, match:, decision_match:, confidence_match:, differences:, actual:, expected:) ⇒ ComparisonResult

Returns a new instance of ComparisonResult.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/decision_agent/testing/test_result_comparator.rb', line 9

def initialize(scenario_id:, match:, decision_match:, confidence_match:, differences:, actual:, expected:)
  @scenario_id = scenario_id.to_s.freeze
  @match = match
  @decision_match = decision_match
  @confidence_match = confidence_match
  @differences = differences.freeze
  @actual = actual
  @expected = expected

  freeze
end

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



7
8
9
# File 'lib/decision_agent/testing/test_result_comparator.rb', line 7

def actual
  @actual
end

#confidence_matchObject (readonly)

Returns the value of attribute confidence_match.



7
8
9
# File 'lib/decision_agent/testing/test_result_comparator.rb', line 7

def confidence_match
  @confidence_match
end

#decision_matchObject (readonly)

Returns the value of attribute decision_match.



7
8
9
# File 'lib/decision_agent/testing/test_result_comparator.rb', line 7

def decision_match
  @decision_match
end

#differencesObject (readonly)

Returns the value of attribute differences.



7
8
9
# File 'lib/decision_agent/testing/test_result_comparator.rb', line 7

def differences
  @differences
end

#expectedObject (readonly)

Returns the value of attribute expected.



7
8
9
# File 'lib/decision_agent/testing/test_result_comparator.rb', line 7

def expected
  @expected
end

#matchObject (readonly)

Returns the value of attribute match.



7
8
9
# File 'lib/decision_agent/testing/test_result_comparator.rb', line 7

def match
  @match
end

#scenario_idObject (readonly)

Returns the value of attribute scenario_id.



7
8
9
# File 'lib/decision_agent/testing/test_result_comparator.rb', line 7

def scenario_id
  @scenario_id
end

Instance Method Details

#to_hObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/decision_agent/testing/test_result_comparator.rb', line 21

def to_h
  {
    scenario_id: @scenario_id,
    match: @match,
    decision_match: @decision_match,
    confidence_match: @confidence_match,
    differences: @differences,
    actual: {
      decision: @actual[:decision],
      confidence: @actual[:confidence]
    },
    expected: {
      decision: @expected[:decision],
      confidence: @expected[:confidence]
    }
  }
end