samba/util/model/currentRoom_test.go
2025-06-04 09:51:39 +08:00

37 lines
878 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"github.com/stretchr/testify/assert"
"testing"
)
func Test_calculateFakeCount(t *testing.T) {
t.Run("实际人数≤506~550", func(t *testing.T) {
for i := 0; i <= 50; i++ {
val := CalculateFakeCount(int64(i))
//t.Log(val)
assert.True(t, val <= 550)
}
})
t.Run("200≥实际人数50204~800", func(t *testing.T) {
for i := 51; i <= 200; i++ {
val := CalculateFakeCount(int64(i))
//t.Log(val)
assert.True(t, val >= 204 && val <= 800)
}
})
t.Run("800≥实际人数200400~1600", func(t *testing.T) {
for i := 201; i <= 800; i++ {
val := CalculateFakeCount(int64(i))
//t.Log(val)
assert.True(t, val >= 400 && val <= 1600)
}
})
t.Run("800", func(t *testing.T) {
for i := 801; i < 800*20; i++ {
val := CalculateFakeCount(int64(i))
assert.True(t, val == int64(i))
}
})
}