-
Notifications
You must be signed in to change notification settings - Fork 1
/
bind_test.go
57 lines (51 loc) · 967 Bytes
/
bind_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
51
52
53
54
55
56
57
package jaws
import (
"sync"
"testing"
"time"
)
func Test_Bind_string(t *testing.T) {
var mu sync.Mutex
var val string
v := Bind(&mu, &val)
if err := v.JawsSetString(nil, "foo"); err != nil {
t.Error(err)
}
if s := v.JawsGetString(nil); s != "foo" {
t.Error(s)
}
}
func Test_Bind_float64(t *testing.T) {
var mu sync.Mutex
var val float64
v := Bind(&mu, &val)
if err := v.JawsSetFloat(nil, 1.2); err != nil {
t.Error(err)
}
if s := v.JawsGetFloat(nil); s != 1.2 {
t.Error(s)
}
}
func Test_Bind_bool(t *testing.T) {
var mu sync.Mutex
var val bool
v := Bind(&mu, &val)
if err := v.JawsSetBool(nil, true); err != nil {
t.Error(err)
}
if s := v.JawsGetBool(nil); s != true {
t.Error(s)
}
}
func Test_Bind_Time(t *testing.T) {
var mu sync.Mutex
var val time.Time
v := Bind(&mu, &val)
now := time.Now()
if err := v.JawsSetTime(nil, now); err != nil {
t.Error(err)
}
if v := v.JawsGetTime(nil); v != now {
t.Error(v)
}
}