Skip to content

Commit

Permalink
further simplified and cleaned up tests
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
  • Loading branch information
technosophos committed Jan 28, 2021
1 parent 869801f commit c707277
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 13 deletions.
4 changes: 0 additions & 4 deletions cryptorandomstringutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ Returns:
error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...)
*/
func CryptoRandomAlphaNumeric(count int) (string, error) {
if count == 0 {
return "", nil
}

return CryptoRandom(count, 0, 0, true, true)
}

Expand Down
1 change: 0 additions & 1 deletion cryptorandomstringutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func TestCryptoRandAlphaNumeric_FuzzOnlyNumeric(t *testing.T) {
charlen++
for i := 0; i < iters; i++ {
out, err := CryptoRandomAlphaNumeric(charlen)
println(out)
if err != nil {
t.Fatal("func failed to produce a random thinger")
}
Expand Down
8 changes: 1 addition & 7 deletions randomstringutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,7 @@ Returns:
error - an error stemming from an invalid parameter within underlying function, RandomSeed(...)
*/
func RandomAlphaNumeric(count int) (string, error) {
RandomString, err := Random(count, 0, 0, true, true)
if err != nil {
return "", fmt.Errorf("Error: %s", err)
}

return RandomString[:count], nil

return Random(count, 0, 0, true, true)
}

/*
Expand Down
1 change: 0 additions & 1 deletion randomstringutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ func TestRandAlphaNumeric_FuzzOnlyNumeric(t *testing.T) {
charlen++
for i := 0; i < iters; i++ {
out, err := RandomAlphaNumeric(charlen)
println(out)
if err != nil {
t.Fatal("func failed to produce a random thinger")
}
Expand Down

0 comments on commit c707277

Please sign in to comment.