package member

import (
	"testing"
)

func TestAlarmType_CodeToString(t *testing.T) {
	tests := []struct {
		alarmType AlarmType
		expected  string
	}{
		{AlarmUninitialized, "uninitialized"}, // 測試初始狀態
		{AlarmNoAlert, "no_alert"},            // 測試未告警狀態
		{AlarmSystem, "system_alert"},         // 測試系統告警
		{AlarmType(999), ""},                  // 測試不存在的狀態
		{AlarmType(-1), ""},                   // 測試無效負數狀態
	}

	for _, tt := range tests {
		t.Run(tt.expected, func(t *testing.T) {
			result := tt.alarmType.CodeToString()
			if result != tt.expected {
				t.Errorf("CodeToString() = %v, want %v", result, tt.expected)
			}
		})
	}
}
