mirror of
https://github.com/Icinga/icingadb.git
synced 2026-06-09 00:42:37 -04:00
Test types.NotificationTypes#Value()
This commit is contained in:
parent
a4632323ab
commit
7a1d2f0036
1 changed files with 24 additions and 0 deletions
|
|
@ -32,3 +32,27 @@ func TestNotificationTypes_UnmarshalJSON(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotificationTypes_Value(t *testing.T) {
|
||||
subtests := []struct {
|
||||
name string
|
||||
io NotificationTypes
|
||||
error bool
|
||||
}{
|
||||
{name: "out-of-range", io: ^NotificationTypes(0), error: true},
|
||||
{name: "empty", io: 0},
|
||||
{name: "single", io: 32},
|
||||
{name: "multiple", io: 48},
|
||||
}
|
||||
|
||||
for _, st := range subtests {
|
||||
t.Run(st.name, func(t *testing.T) {
|
||||
if v, err := st.io.Value(); st.error {
|
||||
require.Error(t, err)
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, int64(st.io), v)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue