Skip to content

Commit

Permalink
Test UUID#Value()
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Jul 5, 2024
1 parent c2d7928 commit d67a982
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 d67a982

Please sign in to comment.