milergeo added

This commit is contained in:
2026-10-06 12:26:57 +05:30
parent 220e934045
commit 9b94be1f07
10 changed files with 329 additions and 44 deletions

View File

@@ -1,6 +1,9 @@
package assignment
import "testing"
import (
"testing"
"time"
)
// The per-miler concurrent-stop cap.
//
@@ -30,3 +33,22 @@ func TestMaxActiveBookings(t *testing.T) {
}
}
}
// The cap counts only stops assigned since midnight India time, so an order
// left open yesterday or last month no longer blocks a working rider.
func TestStartOfISTDay(t *testing.T) {
ist := time.FixedZone("IST", 5*3600+30*60)
cases := []struct{ now, want time.Time }{
// 11:43 IST on 6 Oct -> 00:00 IST 6 Oct
{time.Date(2026, 10, 6, 11, 43, 0, 0, ist), time.Date(2026, 10, 6, 0, 0, 0, 0, ist)},
// 20:00 UTC on 5 Oct is already 01:30 on 6 Oct in India
{time.Date(2026, 10, 5, 20, 0, 0, 0, time.UTC), time.Date(2026, 10, 6, 0, 0, 0, 0, ist)},
// 18:29 UTC on 5 Oct is still 23:59 on 5 Oct in India
{time.Date(2026, 10, 5, 18, 29, 0, 0, time.UTC), time.Date(2026, 10, 5, 0, 0, 0, 0, ist)},
}
for _, c := range cases {
if got := startOfISTDay(c.now); !got.Equal(c.want) {
t.Errorf("startOfISTDay(%v) = %v, want %v", c.now, got, c.want)
}
}
}