summaryrefslogtreecommitdiff
path: root/token_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'token_test.go')
-rw-r--r--token_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/token_test.go b/token_test.go
new file mode 100644
index 0000000..66c131b
--- /dev/null
+++ b/token_test.go
@@ -0,0 +1,30 @@
+package main
+
+import (
+ "testing"
+ "reflect"
+)
+
+func TestNewTokenNoInit(t *testing.T) {
+ empty := Token{}
+
+ token := NewToken()
+
+ if reflect.DeepEqual(empty, token) {
+ t.Fatalf("New token is not initialized.")
+ }
+}
+
+func TestNewTokenLowEntropy(t *testing.T) {
+ token := NewToken()
+
+ first := token.data[0]
+
+ for _, v := range token.data {
+ if v != first {
+ return // at least one other byte contained
+ }
+ }
+
+ t.Fatalf("All bytes in new token are the same.")
+}