Class: Edfize::Tests::Runner
- Inherits:
-
Object
- Object
- Edfize::Tests::Runner
- Defined in:
- lib/edfize/tests/runner.rb
Constant Summary collapse
- TESTS =
%w( expected_length reserved_area_blank reserved_signal_areas_blank )
Instance Attribute Summary collapse
-
#edf ⇒ Object
readonly
Returns the value of attribute edf.
-
#show_passing ⇒ Object
readonly
Returns the value of attribute show_passing.
-
#tests_failed ⇒ Object
readonly
Returns the value of attribute tests_failed.
-
#tests_run ⇒ Object
readonly
Returns the value of attribute tests_run.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#initialize(edf, argv) ⇒ Runner
constructor
A new instance of Runner.
- #print_result(result) ⇒ Object
- #run_tests ⇒ Object
Constructor Details
#initialize(edf, argv) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 12 13 14 |
# File 'lib/edfize/tests/runner.rb', line 8 def initialize(edf, argv) @tests_run = 0 @tests_failed = 0 @edf = edf @verbose = argv.include?('--quiet') ? false : true @show_passing = argv.include?('--failing') ? false : true end |
Instance Attribute Details
#edf ⇒ Object (readonly)
Returns the value of attribute edf.
4 5 6 |
# File 'lib/edfize/tests/runner.rb', line 4 def edf @edf end |
#show_passing ⇒ Object (readonly)
Returns the value of attribute show_passing.
4 5 6 |
# File 'lib/edfize/tests/runner.rb', line 4 def show_passing @show_passing end |
#tests_failed ⇒ Object (readonly)
Returns the value of attribute tests_failed.
4 5 6 |
# File 'lib/edfize/tests/runner.rb', line 4 def tests_failed @tests_failed end |
#tests_run ⇒ Object (readonly)
Returns the value of attribute tests_run.
4 5 6 |
# File 'lib/edfize/tests/runner.rb', line 4 def tests_run @tests_run end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
4 5 6 |
# File 'lib/edfize/tests/runner.rb', line 4 def verbose @verbose end |
Instance Method Details
#print_result(result) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/edfize/tests/runner.rb', line 32 def print_result(result) if self.show_passing or !result.passes puts result.pass_fail unless result.passes or not self.verbose puts result.expected puts result.actual end end end |
#run_tests ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/edfize/tests/runner.rb', line 16 def run_tests results = [] TESTS.each do |test_name| result = Edfize::Tests.send("test_#{test_name}", self) @tests_failed += 1 unless result.passes @tests_run += 1 results << result end puts "\n#{@edf.filename}" if results.reject{|r| r.passes}.count > 0 or @show_passing results.each do |result| print_result(result) end end |