mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-10 16:30:01 +08:00
test(mathx,stringx): add missing edge case tests for CalcEntropy and … (#5471)
This commit is contained in:
@@ -29,3 +29,10 @@ func TestCalcDiffEntropy(t *testing.T) {
|
||||
}
|
||||
assert.True(t, CalcEntropy(m) < .99)
|
||||
}
|
||||
|
||||
func TestCalcEntropySingleItem(t *testing.T) {
|
||||
m := map[any]int{
|
||||
"only": 42,
|
||||
}
|
||||
assert.Equal(t, float64(1), CalcEntropy(m))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user