Class: Rng::TestSuiteParser::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/rng/test_suite_parser.rb

Overview

Represents a single test case with RNC and RNG versions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:) ⇒ TestCase

Returns a new instance of TestCase.



14
15
16
17
18
19
20
21
22
# File 'lib/rng/test_suite_parser.rb', line 14

def initialize(id:)
  @id = id
  @compact_correct = nil
  @compact_incorrect = nil
  @xml_correct = nil
  @xml_incorrect = nil
  @compact_resources = {}
  @xml_resources = {}
end

Instance Attribute Details

#compact_correctObject (readonly)

Returns the value of attribute compact_correct.



10
11
12
# File 'lib/rng/test_suite_parser.rb', line 10

def compact_correct
  @compact_correct
end

#compact_incorrectObject (readonly)

Returns the value of attribute compact_incorrect.



10
11
12
# File 'lib/rng/test_suite_parser.rb', line 10

def compact_incorrect
  @compact_incorrect
end

#compact_resourcesObject (readonly)

Returns the value of attribute compact_resources.



10
11
12
# File 'lib/rng/test_suite_parser.rb', line 10

def compact_resources
  @compact_resources
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/rng/test_suite_parser.rb', line 10

def id
  @id
end

#xml_correctObject (readonly)

Returns the value of attribute xml_correct.



10
11
12
# File 'lib/rng/test_suite_parser.rb', line 10

def xml_correct
  @xml_correct
end

#xml_incorrectObject (readonly)

Returns the value of attribute xml_incorrect.



10
11
12
# File 'lib/rng/test_suite_parser.rb', line 10

def xml_incorrect
  @xml_incorrect
end

#xml_resourcesObject (readonly)

Returns the value of attribute xml_resources.



10
11
12
# File 'lib/rng/test_suite_parser.rb', line 10

def xml_resources
  @xml_resources
end

Instance Method Details

#descriptionObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rng/test_suite_parser.rb', line 40

def description
  if valid_rnc? && valid_rng?
    'RNC ↔ RNG conversion'
  elsif valid_rnc?
    'Valid RNC parsing'
  elsif invalid_rnc?
    'Invalid RNC rejection'
  else
    'Test case'
  end
end

#has_resources?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/rng/test_suite_parser.rb', line 36

def has_resources?
  !compact_resources.empty? || !xml_resources.empty?
end

#invalid_rnc?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/rng/test_suite_parser.rb', line 28

def invalid_rnc?
  !compact_incorrect.nil?
end

#valid_rnc?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/rng/test_suite_parser.rb', line 24

def valid_rnc?
  !compact_correct.nil?
end

#valid_rng?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/rng/test_suite_parser.rb', line 32

def valid_rng?
  !xml_correct.nil?
end