mirror of
https://github.com/donl/gPanel.git
synced 2026-05-26 14:22:18 -06:00
30 lines
681 B
Go
30 lines
681 B
Go
// Encryption package has functions inside of it that utilize various encypting and hashing techniques
|
|
package encryption
|
|
|
|
import "testing"
|
|
|
|
func TestRandomString(t *testing.T) {
|
|
testData := []struct {
|
|
length int
|
|
output string
|
|
}{
|
|
{16, ""},
|
|
{16, ""},
|
|
{16, ""},
|
|
{16, ""},
|
|
}
|
|
|
|
for i := 0; i < len(testData); i++ {
|
|
testData[i].output = RandomString(testData[i].length)
|
|
}
|
|
|
|
for i := 0; i < len(testData)-1; i++ {
|
|
compare := testData[i].output
|
|
|
|
for ii := i + 1; ii < len(testData); ii++ {
|
|
if compare == testData[ii].output {
|
|
t.Errorf("Random string generator generated two strings with the same value. (%s - %s)", compare, testData[ii].output)
|
|
}
|
|
}
|
|
}
|
|
}
|