mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 17:13:51 +00:00
37 lines
502 B
Go
37 lines
502 B
Go
package util
|
|
|
|
import "testing"
|
|
|
|
func TestNotZero(t *testing.T) {
|
|
type args struct {
|
|
v float64
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want bool
|
|
}{
|
|
{
|
|
name: "0",
|
|
args: args{
|
|
v: 0,
|
|
},
|
|
want: false,
|
|
},
|
|
{
|
|
name: "0.00001",
|
|
args: args{
|
|
v: 0.00001,
|
|
},
|
|
want: true,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := NotZero(tt.args.v); got != tt.want {
|
|
t.Errorf("NotZero() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|