Skip to content

Commit 039e76d

Browse files
committedMar 24, 2023
Modify entropy unit test
1 parent f27cd6b commit 039e76d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 

‎utilsOther_test.go

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package main
2+
3+
import (
4+
"runtime"
5+
"testing"
6+
)
7+
8+
func TestDetectOS(t *testing.T) {
9+
// Call the function being tested
10+
actualOS := detectOS()
11+
12+
// Compare the result with the expected value
13+
if actualOS != runtime.GOOS {
14+
t.Errorf("Unexpected OS value, got %s but expected %s", actualOS, runtime.GOOS)
15+
}
16+
}
17+
18+
func TestIsHighEntropy(t *testing.T) {
19+
// Test a low entropy string
20+
if isHighEntropy("aaaaa") {
21+
t.Errorf("Expected low entropy for 'aaaaa'")
22+
}
23+
24+
// Test a high entropy string
25+
if !isHighEntropy("aAbBcC123!@#") {
26+
t.Errorf("Expected high entropy for 'aAbBcC123!@#'")
27+
}
28+
}

0 commit comments

Comments
 (0)
Please sign in to comment.