loading
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# this is your actual code
def bonus_time(salary, bonus)
  "$#{bonus ? salary : salary} "
end

#
# Test code below
# 

require 'test/unit'
require 'test/unit/ui/console/testrunner'

class TestCalculation < Test::Unit::TestCase
  def test_basic
    assert_equal(bonus_time(25000, true), '$250000')
    assert_equal(bonus_time(10000, true), '$100000')
    assert_equal(bonus_time(60000, false), '$60000')
    assert_equal(bonus_time(2, true), '$20')
    assert_equal(bonus_time(78, false), '$78')
    assert_equal(bonus_time(67890, true), '$678900')
  end
end

my_tests = Test::Unit::TestSuite.new("My Tests")
my_tests << TestCalculation.new(:test_basic)

#run the suite
result = Test::Unit::UI::Console::TestRunner.run(my_tests)
if result.passed?
  puts "SUCCESS"
else
  puts "Error"
end
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]