-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhero_tiredness_test.go
40 lines (36 loc) · 1.1 KB
/
hero_tiredness_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
package main
import (
"fmt"
"testing"
)
func TestHeroTiredness(t *testing.T) {
hero := Hero{
maxHealth: 100,
health: 100,
damage: 20,
}
wantDamageReduction := 0
DamageReduction := heroTiredness(hero)
if wantDamageReduction != DamageReduction {
t.Fatalf("ERROR!!! Damage reduction must be equal %d, but euqal %d", wantDamageReduction, DamageReduction)
}
hero.health -= 70
wantDamageReduction = 5
DamageReduction = heroTiredness(hero)
if wantDamageReduction != DamageReduction {
t.Fatalf("ERROR!!! Damage reduction must be equal %d, but euqal %d", wantDamageReduction, DamageReduction)
}
hero.health -= 10
wantDamageReduction = 10
DamageReduction = heroTiredness(hero)
if wantDamageReduction != DamageReduction {
t.Fatalf("ERROR!!! Damage reduction must be equal %d, but euqal %d", wantDamageReduction, DamageReduction)
}
hero.health -= 10
wantDamageReduction = 20
DamageReduction = heroTiredness(hero)
if wantDamageReduction != DamageReduction {
t.Fatalf("ERROR!!! Damage reduction must be equal %d, but euqal %d", wantDamageReduction, DamageReduction)
}
fmt.Print("OK\n")
}