Skip to content

Commit

Permalink
RandomString test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchetti committed Sep 14, 2023
1 parent d1f1bbc commit 8479de1
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions internal/util/random_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,31 @@ func TestRandomSuite(t *testing.T) {
}

func (s *RandomSuite) TestRandomBytes() {
r, err := RandomBytes(32)
s.Nil(err)
s.Len(r, 32)
r1, err := RandomBytes(32)
s.NoError(err)
s.Len(r1, 32)

r2, err := RandomBytes(32)
s.NoError(err)
s.Len(r2, 32)
s.NotEqual(r1, r2)

r3, err := RandomBytes(12)
s.NoError(err)
s.Len(r3, 12)
}

func (s *RandomSuite) TestRandomString() {
r1, err := RandomString(32)
s.NoError(err)
s.Len(r1, 32)

r2, err := RandomString(32)
s.NoError(err)
s.Len(r2, 32)
s.NotEqual(r1, r2)

r3, err := RandomString(12)
s.NoError(err)
s.Len(r3, 12)
}

0 comments on commit 8479de1

Please sign in to comment.