-
Notifications
You must be signed in to change notification settings - Fork 8
/
float_slice_validation_test.go
50 lines (42 loc) · 1.73 KB
/
float_slice_validation_test.go
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
42
43
44
45
46
47
48
49
50
package filter
import (
"testing"
)
// 测试 FromFloatSlice().Require()
func TestFromFloatSliceRequire(t *testing.T) {
t.Log(FromFloatSlice([]float64{}).Require().Error())
t.Log(FromFloatSlice([]float64{0, 0}).Require().Error())
t.Log(FromFloatSlice([]float64{0, 1}).Require().Error())
}
// 测试 FromFloatSlice().MinCount()
func TestFromFloatSliceMinCount(t *testing.T) {
t.Log(FromFloatSlice([]float64{}).MinCount(1).Error())
t.Log(FromFloatSlice([]float64{0}).MinCount(1).Error())
t.Log(FromFloatSlice([]float64{0}).Require().MinCount(1).Error())
t.Log(FromFloatSlice([]float64{3, 5}).MinCount(2).Error())
}
// 测试 FromFloatSlice().MaxCount()
func TestFromFloatSliceMaxCount(t *testing.T) {
t.Log(FromFloatSlice([]float64{}).MaxCount(1).Error())
t.Log(FromFloatSlice([]float64{0, 0}).MaxCount(1).Error())
t.Log(FromFloatSlice([]float64{3, 5}).MaxCount(2).Error())
}
// 测试 FromFloatSlice().MinValue()
func TestFromFloatSliceMinValue(t *testing.T) {
t.Log(FromFloatSlice([]float64{0, 3}).MinValue(2).Error())
t.Log(FromFloatSlice([]float64{3, 5}).MinValue(2).Error())
}
// 测试 FromFloatSlice().MaxValue()
func TestFromFloatSliceMaxValue(t *testing.T) {
t.Log(FromFloatSlice([]float64{1, 5}).MaxValue(5).Error())
}
// 测试 FromFloatSlice().AllowedValues()
func TestFromFloatSliceAllowedValues(t *testing.T) {
t.Log(FromFloatSlice([]float64{1, 3}).AllowedValues([]float64{1, 2, 3}).Error())
t.Log(FromFloatSlice([]float64{1, 2, 3}).AllowedValues([]float64{1, 3}).Error())
}
// 测试 FromFloatSlice().DeniedValues()
func TestFromFloatSliceDeniedValues(t *testing.T) {
t.Log(FromFloatSlice([]float64{1, 2, 4}).DeniedValues([]float64{3, 5}).Error())
t.Log(FromFloatSlice([]float64{1, 2, 3, 4}).DeniedValues([]float64{3, 5}).Error())
}