Skip to content
Snippets Groups Projects
Unverified Commit 88cbb390 authored by Sydney Anne Erickson's avatar Sydney Anne Erickson :chipmunk:
Browse files

Add params.go and status.go tests for Key

parent b8fb49f4
No related branches found
No related tags found
No related merge requests found
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)
}
}
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")
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment