Class: Test::Unit::TestCase
Constant Summary
collapse
- SPASS_TIMEOUT =
5
Instance Method Summary
collapse
#replace_conjecture
#default_options, #exec_spass, #filter_by_name, #output, #pack_stats, #remove_empty_actions, #verify
Instance Method Details
#adsl_assert(expected_result, input, options = {}) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/adsl/util/test_helper.rb', line 14
def adsl_assert(expected_result, input, options={})
ds_spec = ADSL::Parser::ADSLParser.new.parse input
raise "Exactly one action required in ADSL" if ds_spec.actions.length != 1
action_name = ds_spec.actions.first.name
spass = ds_spec.translate_action(action_name)
spass = replace_conjecture spass, options[:conjecture] if options.include? :conjecture
result = exec_spass(spass, options[:timeout] || SPASS_TIMEOUT)
if result == :inconclusive
puts "inconclusive result on testcase #{self.class.name}.#{method_name}"
else
assert_equal expected_result, result
end
rescue Exception => e
puts spass unless spass.nil?
raise e
end
|
#assert_set_equal(expected, actual, failure_msg = nil) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/adsl/util/test_helper.rb', line 59
def assert_set_equal(expected, actual, failure_msg = nil)
expected.each do |elem|
assert_block failure_msg || "Actual collection does not contain `#{elem}'" do
actual.include? elem
end
end
actual.each do |elem|
assert_block failure_msg || "Expected collection does not contain `#{elem}'" do
expected.include? elem
end
end
end
|
#class_defined?(*classes) ⇒ Boolean
43
44
45
46
47
48
|
# File 'lib/adsl/util/test_helper.rb', line 43
def class_defined?(*classes)
classes.each do |klass_name|
return true unless self.class.lookup_const(klass_name).nil?
end
return false
end
|
#in_temp_file(content) ⇒ Object
50
51
52
53
54
55
56
57
|
# File 'lib/adsl/util/test_helper.rb', line 50
def in_temp_file(content)
file = Tempfile.new('test_util')
file.write content
file.close
yield file.path
ensure
file.unlink unless file.nil?
end
|
#spass_assert(expected_result, input, timeout = SPASS_TIMEOUT) ⇒ Object
31
32
33
|
# File 'lib/adsl/util/test_helper.rb', line 31
def spass_assert(expected_result, input, timeout = SPASS_TIMEOUT)
adsl_assert expected_result, input, :timeout => timeout
end
|
#unload_class(*classes) ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/adsl/util/test_helper.rb', line 35
def unload_class(*classes)
classes.each do |klass_name|
const = self.class.lookup_const klass_name
next if const.nil?
const.parent_module.send :remove_const, const.name.split('::').last
end
end
|