package giftlimits import ( "strings" "testing" ) func TestWorkUnitsAppliesCountAndFanoutCeilings(t *testing.T) { if units, ok := WorkUnits(999, 5); !ok || units != 4_995 { t.Fatalf("valid maximum-near workload mismatch: units=%d ok=%t", units, ok) } for _, input := range []struct { count int64 targets int }{{0, 1}, {1_000, 1}, {999, 6}, {1, 0}} { if units, ok := WorkUnits(input.count, input.targets); ok || units != 0 { t.Fatalf("invalid workload accepted: %+v units=%d", input, units) } } } func TestValidCommandIDUsesTrimmedNonEmptyByteBound(t *testing.T) { if !ValidCommandID(" combo-1:42 ") { t.Fatal("normal stable combo command id was rejected") } if ValidCommandID(" ") || ValidCommandID(strings.Repeat("x", MaxCommandIDBytes+1)) { t.Fatal("empty or oversized command id was accepted") } }