diff --git a/key/params_test.go b/key/params_test.go new file mode 100644 index 0000000000000000000000000000000000000000..daa2d304059cc0b0d93272ba8242a9dd39569dbf --- /dev/null +++ b/key/params_test.go @@ -0,0 +1,25 @@ +package key + +// Testing file for the params.go functions + +import "testing" + +// Test that the GetDefaultParams function returns the right default data +func Test_GetDefaultParams(t *testing.T) { + p := GetDefaultParams() + if p.MinKeys != minKeys { + t.Errorf("MinKeys mismatch\r\tGot: %d\r\tExpected: %d", p.MinKeys, minKeys) + } + if p.MaxKeys != maxKeys { + t.Errorf("MinKeys mismatch\r\tGot: %d\r\tExpected: %d", p.MaxKeys, maxKeys) + } + if p.NumRekeys != numReKeys { + t.Errorf("MinKeys mismatch\r\tGot: %d\r\tExpected: %d", p.NumRekeys, numReKeys) + } + if p.TTLScalar != ttlScalar { + t.Errorf("MinKeys mismatch\r\tGot: %d\r\tExpected: %d", p.TTLScalar, ttlScalar) + } + if p.MinNumKeys != threshold { + t.Errorf("MinKeys mismatch\r\tGot: %d\r\tExpected: %d", p.MinNumKeys, threshold) + } +} diff --git a/key/status_test.go b/key/status_test.go new file mode 100644 index 0000000000000000000000000000000000000000..991d76a9d30c121151bc2529e5da8133be3a704d --- /dev/null +++ b/key/status_test.go @@ -0,0 +1,21 @@ +package key + +// Testing file for the status.go functions + +import "testing" + +// Test that Status_String returns the right strings for a status +func Test_Status_String(t *testing.T) { + if Status(Active).String() != "Active" { + t.Errorf("Testing Active returned mismatch.\r\tGot: %s\r\tExpected: %s", Status(Active).String(), "Active") + } + if Status(RekeyNeeded).String() != "Rekey Needed" { + t.Errorf("Testing RekeyNeeded returned mismatch.\r\tGot: %s\r\tExpected: %s", Status(RekeyNeeded).String(), "Rekey Needed") + } + if Status(Empty).String() != "Empty" { + t.Errorf("Testing Empty returned mismatch.\r\tGot: %s\r\tExpected: %s", Status(Empty).String(), "Empty") + } + if Status(RekeyEmpty).String() != "Rekey Empty" { + t.Errorf("Testing RekeyEmpty returned mismatch.\r\tGot: %s\r\tExpected: %s", Status(RekeyEmpty).String(), "Rekey Empty") + } +}