hyapp-server/services/user-service/internal/service/cp/leaderboard_store_test.go
2026-06-11 13:33:44 +08:00

17 lines
626 B
Go

package cp
import "testing"
func TestIntimacyLeaderboardScorePreservesPrimaryIntimacyAndBatchOrder(t *testing.T) {
total := 1000
if intimacyLeaderboardScore(101, total-1, total) <= intimacyLeaderboardScore(100, 0, total) {
t.Fatal("higher intimacy value must always outrank lower intimacy value")
}
if intimacyLeaderboardScore(100, 0, total) <= intimacyLeaderboardScore(100, 1, total) {
t.Fatal("same intimacy value must keep repository order")
}
if intimacyLeaderboardScore(100, 1, total) <= intimacyLeaderboardScore(100, 2, total) {
t.Fatal("same intimacy value must keep stable order across later rows")
}
}