aboutsummaryrefslogtreecommitdiff
path: root/internal/combat/types_test.go
blob: a999eb6c3c9bfc87c44d4c607d0b24e93b581d55 (plain)
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
package combat

import "testing"

func TestIsMeleeType(t *testing.T) {
	melee := []string{AttackStab, AttackSlash, AttackCrush}
	for _, m := range melee {
		if !IsMeleeType(m) {
			t.Errorf("IsMeleeType(%q) = false, want true", m)
		}
	}
	for _, nm := range []string{AttackRanged, AttackScience, "", "magic"} {
		if IsMeleeType(nm) {
			t.Errorf("IsMeleeType(%q) = true, want false", nm)
		}
	}
}

func TestIsValidAttackType(t *testing.T) {
	for _, v := range AllAttackTypes {
		if !IsValidAttackType(v) {
			t.Errorf("IsValidAttackType(%q) = false, want true", v)
		}
	}
	for _, iv := range []string{"", "magic", "melee"} {
		if IsValidAttackType(iv) {
			t.Errorf("IsValidAttackType(%q) = true, want false", iv)
		}
	}
}