package member import "testing" func TestStatus_CodeToString(t *testing.T) { tests := []struct { status Status expected string }{ {AccountStatusUninitialized, "uninitialized"}, {AccountStatusUnverified, "unverified"}, {AccountStatusActive, "active"}, {AccountStatusSuspended, "suspended"}, {Status(999), ""}, // 測試不存在的狀態 } for _, tt := range tests { t.Run(tt.expected, func(t *testing.T) { if result := tt.status.CodeToString(); result != tt.expected { t.Errorf("CodeToString() = %v, want %v", result, tt.expected) } }) } } func TestStatus_ToInt32(t *testing.T) { tests := []struct { status Status expected int32 }{ {AccountStatusUninitialized, 0}, {AccountStatusUnverified, 1}, {AccountStatusActive, 2}, {AccountStatusSuspended, 3}, {Status(999), 999}, // 測試不存在的狀態 } for _, tt := range tests { t.Run(string(tt.expected), func(t *testing.T) { if result := tt.status.ToInt32(); result != tt.expected { t.Errorf("ToInt32() = %v, want %v", result, tt.expected) } }) } }