MCPcopy Index your code
hub / github.com/AlekSi/pointer / TestBool

Function TestBool

pointer_test.go:19–41  ·  view source on GitHub ↗

* Order as in spec: bool byte complex64 complex128 error float32 float64 int int8 int16 int32 int64 rune string uint uint8 uint16 uint32 uint64 uintptr time.Duration time.Time */

(t *testing.T)

Source from the content-addressed store, hash-verified

17*/
18
19func TestBool(t *testing.T) {
20 var x bool
21 if *ToBool(x) != x {
22 t.Errorf("*ToBool(%v)", x)
23 }
24 if ToBoolOrNil(x) != nil {
25 t.Errorf("ToBoolOrNil(%v)", x)
26 }
27 if GetBool(nil) != x {
28 t.Errorf("GetBool(%v)", nil)
29 }
30
31 x = true
32 if *ToBool(x) != x {
33 t.Errorf("*ToBool(%v)", x)
34 }
35 if *ToBoolOrNil(x) != x {
36 t.Errorf("*ToBoolOrNil(%v)", x)
37 }
38 if GetBool(&x) != x {
39 t.Errorf("GetBool(%v)", &x)
40 }
41}
42
43func TestByte(t *testing.T) {
44 var x byte

Callers

nothing calls this directly

Calls 3

ToBoolFunction · 0.85
ToBoolOrNilFunction · 0.85
GetBoolFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…