package utils

import (
	"reflect"
	"testing"

	. "github.com/onsi/gomega"
)

func TestIsZero(t *testing.T) {
	g := NewWithT(t)

	type testStruct struct {
		A int
		B []uint
		C string
		D bool
	}

	tests := []struct {
		name     string
		input    testStruct
		expected bool
	}{
		{
			name:     "all fields are zero",
			input:    testStruct{},
			expected: true,
		},
		{
			name:     "some fields are zero",
			input:    testStruct{A: 1, C: "test"},
			expected: false,
		},
		{
			name:     "all fields are non-zero",
			input:    testStruct{A: 1, B: []uint{1, 2, 3}, C: "test", D: true},
			expected: false,
		},
	}

	for _, tt := range tests {
		g.Expect(IsZero(reflect.ValueOf(tt.input))).To(Equal(tt.expected), tt.name)
	}
}
