This commit is contained in:
2026-06-25 13:56:54 -04:00
parent 3f3913abee
commit 7bc6e2cb4d
5 changed files with 39 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
import time
import pytest
from untitled import content, migration, model, persistence, rules
@@ -47,7 +47,7 @@ def test_migration():
assert "last_updated" in result["cat"]
def test_decay_and_feed():
def test_decay_and_replenish():
cat = model.Save(
version=content.SAVE_VERSION,
cat=model.Cat(
@@ -58,12 +58,16 @@ def test_decay_and_feed():
"eyes": "blue",
"personality": "judges you silently",
},
last_updated=0,
),
)
rules.reconcile(cat.cat, time.time() + 3600)
rules.reconcile(cat.cat, 3600 * 2)
assert cat.cat.happiness < 98
assert cat.cat.fullness < 98
rules.feed(cat.cat)
assert cat.cat.fullness > 98 and cat.cat.fullness <= 100
assert cat.cat.fullness == pytest.approx(100)
rules.reconcile(cat.cat, 7200 + 20 * 3600)
assert cat.cat.happiness < 96 - (content.BASE_HAPPINESS_DECAY_PER_HOUR * 20)
def test_list_saves(tmp_path):