Files
casino/Makefile
drjones dee3becd47 fix(sim): cap crash point so extreme seeds cannot overflow or bankrupt
At u=1 the unsigned quotient exceeded int64 and wrapped negative, so the
rarest and most valuable outcome silently became an instant 1.00x loss.
At u=2 it produced a 2.1-billion-times payout the house could never
cover, which would have left settlement failing and the player unpaid.
The crash point is now capped at the largest multiplier the curve can
express, which is unreachable anyway since the round hits its tick
ceiling first.

FromInt now panics outside the Q32.32 integer range instead of wrapping
a positive input into a negative value.

Raises coverage to 88% overall; adds a Makefile with db-reset, since the
append-only ledger steadily consumes bridge headroom across test runs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 15:52:50 +00:00

59 lines
1.9 KiB
Makefile

.PHONY: help test test-race test-e2e cover db-up db-reset run build lint
help:
@echo "test run unit and integration tests"
@echo "test-race run tests under the race detector"
@echo "test-e2e run end-to-end tests against a live server"
@echo "cover report coverage per package"
@echo "db-up start postgres and redis"
@echo "db-reset destroy and recreate the database"
@echo "run run the server with the dev faucet enabled"
@echo "build build the server binary"
test: db-up
go test ./... -count=1
test-race: db-up
go test ./pkg/... -race -count=1
# The end-to-end suite drives a live server; start one first.
test-e2e: db-up build
@echo "start the server with 'make run' in another shell, then:"
@echo " ARCADE_E2E=http://localhost:8080 go test ./cmd/arcade/ -v"
cover: db-up
go test ./pkg/... -count=1 -coverprofile=coverage.out
go tool cover -func=coverage.out | tail -1
db-up:
@docker compose up -d postgres redis >/dev/null
@for i in $$(seq 1 40); do \
docker compose exec -T postgres pg_isready -U arcade >/dev/null 2>&1 && exit 0; \
sleep 1; \
done; echo "postgres did not become ready" >&2; exit 1
# The ledger is append-only, so tests that mint large amounts steadily consume
# the bridge's headroom. This wipes the volume and reapplies every migration.
db-reset:
docker compose down -v
docker compose up -d postgres
@for i in $$(seq 1 40); do \
docker compose exec -T postgres pg_isready -U arcade >/dev/null 2>&1 && break; \
sleep 1; \
done
@# Migrations are mounted into docker-entrypoint-initdb.d and run
@# automatically on a fresh volume, so there is nothing to apply here.
@docker compose exec -T postgres psql -q -U arcade -d arcade \
-c "SELECT count(*) AS tables FROM information_schema.tables WHERE table_schema='public'"
@echo "database reset"
run: db-up
ARCADE_DEV_FAUCET=1 go run ./cmd/arcade
build:
go build -o bin/qa ./cmd/arcade
lint:
go vet ./...
gofmt -l .