entropy_test.go 280 B

1234567891011121314151617
  1. package mathx
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestCalcEntropy(t *testing.T) {
  7. const total = 1000
  8. const count = 100
  9. m := make(map[interface{}]int, total)
  10. for i := 0; i < total; i++ {
  11. m[i] = count
  12. }
  13. assert.True(t, CalcEntropy(m) > .99)
  14. }