[🤖] Add Unit-Tests
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m34s

This commit is contained in:
2026-04-27 10:46:08 +02:00
parent dad0e3240d
commit 02d6894ec6
116 changed files with 18795 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
package langext
import (
"git.blackforestbytes.com/BlackForestBytes/goext/tst"
"testing"
)
func TestRandBytesLength(t *testing.T) {
for _, sz := range []int{0, 1, 16, 32, 1024} {
b := RandBytes(sz)
tst.AssertEqual(t, len(b), sz)
}
}
func TestRandBytesDistinct(t *testing.T) {
a := RandBytes(32)
b := RandBytes(32)
// Two cryptographic random sequences should not be equal in 32 bytes.
if len(a) != 32 || len(b) != 32 {
t.Fatalf("unexpected length")
}
equal := true
for i := range a {
if a[i] != b[i] {
equal = false
break
}
}
if equal {
t.Errorf("two consecutive 32-byte RandBytes calls returned identical results")
}
}