-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgocharge_test.go
44 lines (40 loc) · 960 Bytes
/
gocharge_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
package gocharge_test
import (
"fmt"
"strings"
"testing"
"time"
"github.com/charleypeng/gocharge"
"github.com/charleypeng/gocharge/dtos"
"github.com/google/uuid"
)
func TestVersion(t *testing.T) {
//Version()
fmt.Println("testing")
dto := []dtos.LoginDto{
{
UserName: "data",
Age: 432,
},
{
UserName: "mama",
Age: 42,
},
}
lst := gocharge.NewList(dto)
for i := 0; i < 1000000; i++ {
id := uuid.New()
lst.Add(dtos.LoginDto{UserName: id.String(), Age: i})
}
t2 := time.Now()
// result2 := gocharge.WhereT(&lst.Items, func(u dtos.LoginDto) bool {
// return strings.Contains(u.UserName, "ma") || strings.Contains(u.UserName, "0b")
// })
result := lst.Where(func(u dtos.LoginDto) bool {
return strings.Contains(u.UserName, "ma") || strings.Contains(u.UserName, "9e0")
})
fmt.Println("====data test===============\n", "used:", time.Since(t2))
fmt.Println(result)
//fmt.Println(result2)
//myfmt.(&l)
}