1 // Copyright 2019, The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE.md file.
14 func TestIsZero(t *testing.T) {
25 {map[string]bool(nil), true},
26 {map[string]bool{}, false},
28 {&tar.Header{}, false},
29 {tar.Header{Name: "foo"}, false},
30 {(chan bool)(nil), true},
31 {make(chan bool), false},
32 {(func(*testing.T))(nil), true},
34 {[...]int{0, 0, 0}, true},
35 {[...]int{0, 1, 0}, false},
36 {math.Copysign(0, +1), true},
37 {math.Copysign(0, -1), false},
38 {complex(math.Copysign(0, +1), math.Copysign(0, +1)), true},
39 {complex(math.Copysign(0, -1), math.Copysign(0, +1)), false},
40 {complex(math.Copysign(0, +1), math.Copysign(0, -1)), false},
41 {complex(math.Copysign(0, -1), math.Copysign(0, -1)), false},
44 for _, tt := range tests {
45 t.Run("", func(t *testing.T) {
46 got := IsZero(reflect.ValueOf(tt.in))
48 t.Errorf("IsZero(%v) = %v, want %v", tt.in, got, tt.want)