forked from montanaflynn/stats
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil_test.go
More file actions
41 lines (37 loc) · 698 Bytes
/
Copy pathutil_test.go
File metadata and controls
41 lines (37 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package stats
import (
"math/rand"
"testing"
)
// makeFloatSlice makes a slice of float64s
func makeFloatSlice(c int) []float64 {
lf := make([]float64, 0, c)
for i := 0; i < c; i++ {
f := float64(i * 100)
lf = append(lf, f)
}
return lf
}
func makeRandFloatSlice(c int) []float64 {
lf := make([]float64, 0, c)
rand.Seed(unixnano())
for i := 0; i < c; i++ {
f := float64(i * 100)
lf = append(lf, f)
}
return lf
}
func TestFloat64ToInt(t *testing.T) {
m := float64ToInt(234.0234)
if m != 234 {
t.Errorf("%x != %x", m, 234)
}
m = float64ToInt(-234.0234)
if m != -234 {
t.Errorf("%x != %x", m, -234)
}
m = float64ToInt(1)
if m != 1 {
t.Errorf("%x != %x", m, 1)
}
}