-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincrease_weapon_damage_test.go
58 lines (51 loc) · 1.47 KB
/
increase_weapon_damage_test.go
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
package main
import (
"fmt"
"testing"
)
func TestIncreaseWeapondamage(t *testing.T) {
crossbow := Weapon{
name: "crossbow",
damage: 30,
minDamage: 15,
missChance: 20,
numberOfUsing: 100,
ItemUsed: 0,
}
pan := Weapon{
name: "pan",
damage: 10,
missChance: 0,
numberOfUsing: 10,
ItemUsed: 0,
}
sword := Weapon{
name: "sword",
damage: 30,
missChance: 20,
numberOfUsing: 1,
ItemUsed: 0,
}
wantCrossbowDamage := 27
crossbow, _, _ = increaseWeaponDamage(crossbow, crossbow, pan, sword)
if crossbow.damage != wantCrossbowDamage {
t.Fatalf("ERROR!!! This wapon damage must be equal %d, but equal %d", wantCrossbowDamage, crossbow.damage)
}
crossbow.damage = 7
wantCrossbowDamage = 6
crossbow, _, _ = increaseWeaponDamage(crossbow, crossbow, pan, sword)
if crossbow.damage != wantCrossbowDamage {
t.Fatalf("ERROR!!! This wapon damage must be equal %d, but equal %d", wantCrossbowDamage, crossbow.damage)
}
wantPanDamage := 9
fmt.Println(pan)
_, pan, _ = increaseWeaponDamage(pan, crossbow, pan, sword)
if pan.damage != wantPanDamage {
t.Fatalf("ERROR!!! This wapon damage must be equal %d, but equal %d", wantPanDamage, pan.damage)
}
wantSwordDamage := 30
_, _, sword = increaseWeaponDamage(sword, crossbow, pan, sword)
if sword.damage != wantSwordDamage {
t.Fatalf("ERROR!!! This wapon damage must be equal %d, but equal %d", wantSwordDamage, sword.damage)
}
}