-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaixa_test.go
More file actions
71 lines (59 loc) · 2.08 KB
/
caixa_test.go
File metadata and controls
71 lines (59 loc) · 2.08 KB
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
66
67
68
69
70
71
package main
import "testing"
func TestCaixaEletronico(t *testing.T) {
// <setup code>
t.Run("result10", func(t *testing.T) {
notas := Saque(10)
if !(notas[0] == 1 && notas[1] == 0 && notas[2] == 0 && notas[3] == 0){
t.Errorf("Incorrect value")
}
})
t.Run("result20", func(t *testing.T) {
notas := Saque(20)
if !(notas[0] == 0 && notas[1] == 1 && notas[2] == 0 && notas[3] == 0){
t.Errorf("incorrect, got: %d, want: %d.", notas, 20)
}
})
t.Run("result50", func(t *testing.T) {
notas := Saque(50)
if !(notas[0] == 0 && notas[1] == 0 && notas[2] == 1 && notas[3] == 0) {
t.Errorf("incorrect, got: %d, want: %d.", notas, 50)
}
})
t.Run("result100", func(t *testing.T) {
notas := Saque(100)
if !(notas[0] == 0 && notas[1] == 0 && notas[2] == 0 && notas[3] == 1){
t.Errorf("incorrect, got: %d, want: %d.", notas, 100)
}
})
t.Run("result30", func(t *testing.T) {
notas := Saque(30)
if !(notas[0] == 1 && notas[1] == 1 && notas[2] == 0 && notas[3] == 0){
t.Errorf("incorrect, got: %d, want: %d.", notas, 30)
}
})
t.Run("result80", func(t *testing.T) {
notas := Saque(80)
if !(notas[0] == 1 && notas[1] == 1 && notas[2] == 1 && notas[3] == 0){
t.Errorf("incorrect, got: %d, want: %d.", notas, 80)
}
})
t.Run("result0", func(t *testing.T) {
notas := Saque(0)
if !(notas[0] == 0 && notas[1] == 0 && notas[2] == 0 && notas[3] == 0){
t.Errorf("incorrect, got: %d, want: %d.", notas, 0)
}
})
t.Run("result480", func(t *testing.T) {
notas := Saque(480)
if !(notas[0] == 1 && notas[1] == 1 && notas[2] == 1 && notas[3] == 4){
t.Errorf("incorrect, got: %d, want: %d.", notas, 480)
}
})
t.Run("result485", func(t *testing.T) {
notas := Saque(485)
if !(notas[0] == -1 && notas[1] == -1 && notas[2] == -1 && notas[3] == -1){
t.Errorf("incorrect, got: %d, want: %d.", notas, 485)
}
})
}