Files
8bitMyGoUI/game/count_internal_test.go
T
ZacharyZhang-NY 86a6901333 Add game components 269-290; CommandMenu AutoFocus
Press start, title screen, save slots, options menu, game over with
CONTINUE, credits roll, ending card, loading tips, letterbox, mission
brief, achievements, result screen, crafting grid, loot popup,
treasure chest, gacha reel, interact prompt, turn order, battle log,
target selector, ATB gauge and stamina bar. Cued effects count runs,
so each cue change plays once and reports once. CommandMenu takes
AutoFocus when enabled. HealthBar, ManaBar and CountUp keep exact
colors, ticks and counts for the largest ints.
2026-10-12 02:48:20 -04:00

19 lines
460 B
Go

package game
import (
"math"
"testing"
"time"
)
func TestCountsNeverOverflow(t *testing.T) {
for _, tc := range [][3]int{{math.MaxInt64, 15, math.MaxInt64}, {100, 7, 46}, {0, 3, 0}, {29, 15, 29}} {
if got := upTo(tc[0], tc[1], 15); got != tc[2] {
t.Errorf("upTo(%d, %d, 15) = %d, want %d", tc[0], tc[1], got, tc[2])
}
}
if got := upTo(time.Duration(math.MaxInt64), 15, 15); got != math.MaxInt64 {
t.Errorf("a long run counts to %d", got)
}
}