diff options
Diffstat (limited to 'internal/casino/craps_clock_test.go')
| -rw-r--r-- | internal/casino/craps_clock_test.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/internal/casino/craps_clock_test.go b/internal/casino/craps_clock_test.go index 8f606f9..f9ad445 100644 --- a/internal/casino/craps_clock_test.go +++ b/internal/casino/craps_clock_test.go @@ -71,6 +71,7 @@ func TestCrapsSoloAndRosterTransitions(t *testing.T) { t.Fatal("solo deadline", tb.view()) } tb.action("alice", "roll") + tb.tickElapsed(3 * time.Second) if tb.dice == [2]int{} { t.Fatal("solo could not roll") } @@ -196,7 +197,7 @@ func TestCrapsConsolidatedResultsAndBetNumbers(t *testing.T) { tb.join("alice") w := &testWallet{chips: 1000} events := tb.bet("alice", "pass", 10, w) - if !strings.Contains(crapsEventText(events), "ROLL RESULTS ON YOUR BETS") { + if !strings.Contains(crapsEventText(events), "ROLL OUTCOMES") { t.Fatal("no post-bet roll table") } tb.bet("alice", "dontpass", 10, w) @@ -204,7 +205,7 @@ func TestCrapsConsolidatedResultsAndBetNumbers(t *testing.T) { events = tb.resolveRoll(3, 4) balances, settlements := 0, 0 for _, e := range events { - if e.ShowBalance { + if e.ShowBalance || (e.Menu != nil && e.Menu.ShowBalance) { balances++ } if strings.Contains(e.Message, "Pass [5]:") || strings.Contains(e.Message, "Pass [5]") { @@ -258,18 +259,18 @@ func TestCrapsUnbetAllAndRollTableFormat(t *testing.T) { if w.paid != before+40 { t.Fatal("second unbet all moved money", w.paid) } - // Roll table formatting: grouped totals, single-level tags only. + // Roll outcome line: every total once, single-level tags only. tb2 := crapsFixture() tb2.join("alice") w2 := &testWallet{chips: 100} tb2.bet("alice", "pass", 1, w2) table := tb2.rollTable(tb2.players.get("alice")) - for _, tag := range []string{"{casino_payout}7{/}", "{casino_result_win}+1{/}", "{casino_payout}2{/}", "{casino_result_loss}-1{/}"} { + for _, tag := range []string{"{casino_result_win}7(+1){/}", "{casino_result_loss}2(-1){/}", "{dim}4(-){/}"} { if !strings.Contains(table, tag) { t.Fatal("missing", tag, table) } } - if strings.Contains(table, "{casino_muted}") || strings.Contains(table, "{casino_result_win}+{") { + if strings.Contains(table, "{casino_muted}") || strings.Contains(table, "{casino_result_win}+") { t.Fatal("nested or unknown tag", table) } } @@ -282,12 +283,12 @@ func TestCrapsRollTableHardPairLabels(t *testing.T) { tb.bet("alice", "hop 2 3", 10, w) tb.point = 8 table := tb.rollTable(tb.players.get("alice")) - for _, want := range []string{"{casino_payout}4+4{/}", "{casino_result_win}+80{/}", "{casino_payout}2+3{/}", "{casino_result_win}+150{/}", "{casino_payout}2+6{/}", "{casino_result_loss}-20{/}"} { + for _, want := range []string{"{casino_result_win}5(+150){/}", "{casino_result_win}8(+80){/}", "{casino_result_loss}7(-20){/}"} { if !strings.Contains(table, want) { t.Fatal("missing", want, table) } } - // Bets paying on the same total combine into one row. + // Bets paying on the same total combine into one entry. tb2 := crapsFixture() tb2.join("alice") w2 := &testWallet{chips: 100} @@ -295,15 +296,16 @@ func TestCrapsRollTableHardPairLabels(t *testing.T) { tb2.bet("alice", "place 8", 12, w2) tb2.point = 8 table = tb2.rollTable(tb2.players.get("alice")) - if strings.Count(table, "{casino_payout}8{/}") != 1 || !strings.Contains(table, "{casino_result_win}+4{/}") { - t.Fatal("same-label payouts must combine", table) + if strings.Count(table, "8(") != 1 || !strings.Contains(table, "{casino_result_win}8(+4){/}") { + t.Fatal("same-total payouts must combine", table) } - // Hard bets alone on the come-out pay nothing and say so. + // Hard bets alone on the come-out are off: every total is dim. tb3 := crapsFixture() tb3.join("alice") w3 := &testWallet{chips: 100} tb3.bet("alice", "hard 8", 10, w3) - if text := tb3.rollTable(tb3.players.get("alice")); !strings.Contains(text, "OFF on the come-out") { + text := tb3.rollTable(tb3.players.get("alice")) + if !strings.Contains(text, "{dim}8(-){/}") || strings.Contains(text, "casino_result_win") || strings.Contains(text, "casino_result_loss") { t.Fatal(text) } } |
