Skip to content

Commit

Permalink
Merge pull request #25 from Icinga/test-UUID
Browse files Browse the repository at this point in the history
Test UUID#Value()
  • Loading branch information
julianbrost authored Jul 25, 2024
2 parents 72ab1a1 + d67a982 commit 8c04ed8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions types/uuid_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package types

import (
"github.com/google/uuid"
"github.com/stretchr/testify/require"
"testing"
)

func TestUUID_Value(t *testing.T) {
nonzero := uuid.New()

subtests := []struct {
name string
input uuid.UUID
output []byte
}{
{"zero", uuid.UUID{}, make([]byte, 16)},
{"nonzero", nonzero, nonzero[:]},
}

for _, st := range subtests {
t.Run(st.name, func(t *testing.T) {
actual, err := UUID{st.input}.Value()

require.NoError(t, err)
require.Equal(t, st.output, actual)
})
}
}

0 comments on commit 8c04ed8

Please sign in to comment.