- rokit.toml: rojo 7.7.1, selene 0.32.0, stylua 2.6.0, lune 0.11.0 - default.project.json: Shared/Server/Client 매핑, 바닥판과 스폰 - src/shared/Economy.luau: ECONOMY.md 수치 - tests/Economy.spec.luau: lune 단위 테스트 - tools/check.sh: stylua·selene·lune·rojo build 일괄 실행 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
967 B
Lua
35 lines
967 B
Lua
-- 로블록스 없이 서버에서 돌리는 단위 테스트: lune run tests/Economy.spec.luau
|
|
local Economy = require("../src/shared/Economy")
|
|
|
|
local failures = 0
|
|
local function check(cond: boolean, msg: string)
|
|
if not cond then
|
|
failures += 1
|
|
print("FAIL " .. msg)
|
|
end
|
|
end
|
|
|
|
check(#Economy.PURCHASES == 10, "구매 항목은 10개")
|
|
|
|
local seen = {}
|
|
local prev = 0
|
|
for i, p in Economy.PURCHASES do
|
|
check(p.cost > prev, `#{i} {p.id} 비용이 앞 단계보다 커야 함`)
|
|
prev = p.cost
|
|
check(seen[p.id] == nil, `#{i} {p.id} id 중복`)
|
|
seen[p.id] = true
|
|
if p.effect.menu then
|
|
check(Economy.MENUS[p.effect.menu] ~= nil, `#{i} 없는 메뉴 {p.effect.menu}`)
|
|
end
|
|
end
|
|
|
|
check(Economy.PURCHASES[#Economy.PURCHASES].id == "Expand", "마지막 구매는 확장")
|
|
for _, m in Economy.START.menus do
|
|
check(Economy.MENUS[m] ~= nil, `시작 메뉴 {m} 없음`)
|
|
end
|
|
|
|
if failures > 0 then
|
|
error(`{failures} test(s) failed`)
|
|
end
|
|
print("Economy.spec: all passed")
|