Files
ArmedPolice/utils/array_test.go

51 lines
765 B
Go
Raw Normal View History

2021-11-02 09:43:19 +08:00
package utils
import (
2021-11-15 17:32:23 +08:00
"fmt"
2021-11-02 09:43:19 +08:00
"reflect"
"testing"
2021-11-15 17:32:23 +08:00
"time"
2021-11-02 09:43:19 +08:00
)
const (
a = 0x00001
b = 0x00010
c = 0x00100
)
func TestArrayFlip(t *testing.T) {
2021-11-15 17:32:23 +08:00
////flip := []uint64{1, 2, 3, 4}
////out := ArrayFlip(flip)
////t.Logf("out%v\n", out)
//
//d := a & b & c
//t.Log(d)
2021-11-02 09:43:19 +08:00
2021-11-15 17:32:23 +08:00
list := []int{1, 2, 3}
for _, v := range list {
go func() {
fmt.Printf("%d\n", v)
}()
time.Sleep(1 * time.Second)
}
2021-11-02 09:43:19 +08:00
}
func TestArrayStrings(t *testing.T) {
a := []uint64{1, 2, 3, 4, 5}
t.Log(a)
t.Log(reflect.TypeOf(a).String())
b := ArrayStrings(a)
t.Log(b)
t.Log(reflect.TypeOf(b).String())
}
2021-11-16 11:46:44 +08:00
func TestArrayUnique(t *testing.T) {
a := []uint64{1, 2, 3, 4, 5, 5, 5}
b := ArrayUnique(a)
t.Log(b)
for _, v := range b {
fmt.Printf(reflect.TypeOf(v).String())
}
}