-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils_test.go
47 lines (37 loc) · 1.15 KB
/
utils_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
package gotils_test
import (
"log"
"testing"
"time"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
gotils "github.com/korovkin/gotils"
)
func init() {
log.SetFlags(log.Ltime | log.Lshortfile | log.Lmicroseconds | log.Ldate)
}
func TestImplode2(t *testing.T) {
superman, batman := gotils.Explode2(gotils.Implode2("superman", "batman"))
assert.Equal(t, superman, "superman", "")
assert.Equal(t, batman, "batman", "")
}
func TestImplode3(t *testing.T) {
superman, batman, spiderman := gotils.Explode3(gotils.Implode3("superman", "batman", "spiderman"))
assert.Equal(t, superman, "superman", "")
assert.Equal(t, batman, "batman", "")
assert.Equal(t, spiderman, "spiderman", "")
}
func TestUniqueID(t *testing.T) {
superman, batman, spiderman := gotils.Explode3(gotils.Implode3("superman", "batman", "spiderman"))
assert.Equal(t, superman, "superman", "")
assert.Equal(t, batman, "batman", "")
assert.Equal(t, spiderman, "spiderman", "")
}
func TestUniqueIDs(t *testing.T) {
RegisterTestingT(t)
t.Run("ids", func(_ *testing.T) {
now := time.Now()
a, aa := gotils.GenerateUniqueID("test", now)
log.Println("=> a:", a, aa)
})
}