aboutsummaryrefslogtreecommitdiff
path: root/internal/game/hardening_shipped_content_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/hardening_shipped_content_test.go')
-rw-r--r--internal/game/hardening_shipped_content_test.go60
1 files changed, 60 insertions, 0 deletions
diff --git a/internal/game/hardening_shipped_content_test.go b/internal/game/hardening_shipped_content_test.go
new file mode 100644
index 0000000..9379395
--- /dev/null
+++ b/internal/game/hardening_shipped_content_test.go
@@ -0,0 +1,60 @@
+package game
+
+// Regression: pins the shipped content fixed alongside the validator work.
+// The iron-bar smelt formula must improve with level (it previously capped at
+// 50% at every level, destroying half the ore forever), and the pastry/pizza
+// dough combines must return their empty containers like bread dough does.
+
+import (
+ "path/filepath"
+ "testing"
+
+ "thehouseoficarus/internal/item"
+)
+
+func TestShippedIronBarSmeltFormulaImprovesWithLevel(t *testing.T) {
+ store := item.NewItemStore(filepath.Join("..", "..", "data"))
+ def, err := store.Load("iron_bar")
+ if err != nil {
+ t.Fatalf("load iron_bar: %v", err)
+ }
+ c := def.FirstCraft()
+ if c == nil {
+ t.Fatal("iron_bar has no craft recipe")
+ }
+ if c.Success == nil {
+ t.Fatal("iron_bar must define a success formula (fail_message/smelting failure otherwise unreachable)")
+ }
+ if c.Success.PerLevel <= 0 {
+ t.Errorf("iron_bar success per_level = %v, want > 0 (failure must become rarer with level)", c.Success.PerLevel)
+ }
+ if c.Success.Cap <= c.Success.Base {
+ t.Errorf("iron_bar success base=%v cap=%v, want cap > base (a permanent fixed chance is the defect)",
+ c.Success.Base, c.Success.Cap)
+ }
+}
+
+func TestShippedDoughRecipesReturnEmptyContainers(t *testing.T) {
+ store := item.NewItemStore(filepath.Join("..", "..", "data"))
+ for _, id := range []string{"pastry_dough", "pizza_dough"} {
+ def, err := store.Load(id)
+ if err != nil {
+ t.Fatalf("load %s: %v", id, err)
+ }
+ c := def.FirstCraft()
+ if c == nil {
+ t.Fatalf("%s has no craft recipe", id)
+ }
+ got := map[string]bool{}
+ for _, e := range c.Ingredients {
+ for _, bp := range e.Byproducts {
+ got[bp] = true
+ }
+ }
+ for _, want := range []string{"empty_pot", "empty_bucket"} {
+ if !got[want] {
+ t.Errorf("%s must return %s as a byproduct so the container is not destroyed", id, want)
+ }
+ }
+ }
+}