aboutsummaryrefslogtreecommitdiff
path: root/internal/item/house_edge_test.go
blob: 574a68fc728e921d93ce85f0089c71237d8d6d3f (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
package item

import "testing"

// TestHouseEdgeItemDefinitions pins the two house-edge reference items: the
// tile shows whole percent, the computus shows hundredths. Neither stacks
// (the precision is a capability, not a quantity) and both are valuable
// enough that a player will bank them rather than drop them.
func TestHouseEdgeItemDefinitions(t *testing.T) {
	store := NewItemStore("../../data")
	for _, tc := range []struct {
		id        string
		precision int
	}{
		{"house_edge_tile", 0},
		{"house_edge_computus", 2},
	} {
		def, err := store.Load(tc.id)
		if err != nil {
			t.Fatalf("load %s: %v", tc.id, err)
		}
		if def.HouseEdgePrecision == nil || *def.HouseEdgePrecision != tc.precision {
			t.Fatalf("%s: house_edge_precision = %v, want %d", tc.id, def.HouseEdgePrecision, tc.precision)
		}
		if def.Stackable {
			t.Fatalf("%s must not stack (its precision is a capability, not a quantity)", tc.id)
		}
	}
}