-
Notifications
You must be signed in to change notification settings - Fork 5
/
change_machine.rb
66 lines (56 loc) · 1.54 KB
/
change_machine.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require 'minitest/autorun'
class ChangeMachine
# Returns an array indicating the quantity of
# each denomination required.
# [pennies, nickels, dimes, quarters]
def issue_coins(amount_in_cents)
return [1, 0, 0, 1]
end
end
class ChangeMachineTest < Minitest::Unit::TestCase
def test_one_penny
machine = ChangeMachine.new
coins = machine.issue_coins(1)
assert_equal [1, 0, 0, 0], coins
end
# def test_pennies
# machine = ChangeMachine.new
# coins = machine.issue_coins(4)
# assert_equal [4, 0, 0, 0], coins
# end
# def test_nickels
# machine = ChangeMachine.new
# coins = machine.issue_coins(5)
# assert_equal [0, 1, 0, 0], coins
# end
# def test_nickels_and_pennies
# machine = ChangeMachine.new
# coins = machine.issue_coins(6)
# assert_equal [1, 1, 0, 0], coins
# end
# def test_dimes
# machine = ChangeMachine.new
# coins = machine.issue_coins(10)
# assert_equal [0, 0, 1, 0], coins
# end
# def test_dimes_and_nickels
# machine = ChangeMachine.new
# coins = machine.issue_coins(15)
# assert_equal [0, 1, 1, 0], coins
# end
# def test_quarters
# machine = ChangeMachine.new
# coins = machine.issue_coins(25)
# assert_equal [0, 0, 0, 1], coins
# end
# def test_quarters_and_dimes
# machine = ChangeMachine.new
# coins = machine.issue_coins(35)
# assert_equal [0, 0, 1, 1], coins
# end
# def test_99
# machine = ChangeMachine.new
# coins = machine.issue_coins(99)
# assert_equal [4, 0, 2, 3], coins
# end
end