Skip to content
Snippets Groups Projects
Commit 8e4843c7 authored by Jake Taylor's avatar Jake Taylor
Browse files

added testing for new params bindings

parent 03a85ced
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,9 @@
package bindings
import "gitlab.com/elixxir/client/interfaces/params"
import (
"gitlab.com/elixxir/client/interfaces/params"
)
func (c *Client) GetCMIXParams() (string, error) {
p, err := params.GetDefaultCMIX().Marshal()
......
......@@ -18,3 +18,38 @@ func TestGetDefaultCMIX(t *testing.T) {
t.Errorf("GetDefaultCMIX did not return expected values")
}
}
// New params path
func TestGetCMIXParameters(t *testing.T) {
p := GetDefaultCMIX()
expected := p.RoundTries + 1
p.RoundTries = expected
jsonString, err := p.Marshal()
if err != nil {
t.Errorf("%+v", err)
}
q, err := GetCMIXParameters(string(jsonString))
if err != nil {
t.Errorf("%+v", err)
}
if q.RoundTries != expected {
t.Errorf("Parameters failed to change! Got %d, Expected %d", q.RoundTries, expected)
}
}
// No new params path
func TestGetCMIXParameters_Default(t *testing.T) {
p := GetDefaultCMIX()
q, err := GetCMIXParameters("")
if err != nil {
t.Errorf("%+v", err)
}
if q.RoundTries != p.RoundTries {
t.Errorf("Parameters failed to change! Got %d, Expected %d", q.RoundTries, p.RoundTries)
}
}
......@@ -31,3 +31,38 @@ func TestSendType_String(t *testing.T) {
t.Errorf("Running String on unknown E2E type got %s", e.Type.String())
}
}
// New params path
func TestGetE2EParameters(t *testing.T) {
p := GetDefaultE2E()
expected := p.RoundTries + 1
p.RoundTries = expected
jsonString, err := p.Marshal()
if err != nil {
t.Errorf("%+v", err)
}
q, err := GetE2EParameters(string(jsonString))
if err != nil {
t.Errorf("%+v", err)
}
if q.RoundTries != expected {
t.Errorf("Parameters failed to change! Got %d, Expected %d", q.RoundTries, expected)
}
}
// No new params path
func TestGetE2EParameters_Default(t *testing.T) {
p := GetDefaultE2E()
q, err := GetE2EParameters("")
if err != nil {
t.Errorf("%+v", err)
}
if q.RoundTries != p.RoundTries {
t.Errorf("Parameters failed to change! Got %d, Expected %d", q.RoundTries, p.RoundTries)
}
}
////////////////////////////////////////////////////////////////////////////////
// Copyright © 2021 Privategrity Corporation /
// /
// All rights reserved. /
////////////////////////////////////////////////////////////////////////////////
package params
import "testing"
// New params path
func TestGetRekeyParameters(t *testing.T) {
p := GetDefaultRekey()
expected := p.RoundTimeout + 1
p.RoundTimeout = expected
jsonString, err := p.Marshal()
if err != nil {
t.Errorf("%+v", err)
}
q, err := GetRekeyParameters(string(jsonString))
if err != nil {
t.Errorf("%+v", err)
}
if q.RoundTimeout != expected {
t.Errorf("Parameters failed to change! Got %d, Expected %d", q.RoundTimeout, expected)
}
}
// No new params path
func TestGetRekeyParameters_Default(t *testing.T) {
p := GetDefaultRekey()
q, err := GetRekeyParameters("")
if err != nil {
t.Errorf("%+v", err)
}
if q.RoundTimeout != p.RoundTimeout {
t.Errorf("Parameters failed to change! Got %d, Expected %d", q.RoundTimeout, p.RoundTimeout)
}
}
////////////////////////////////////////////////////////////////////////////////
// Copyright © 2021 Privategrity Corporation /
// /
// All rights reserved. /
////////////////////////////////////////////////////////////////////////////////
package params
import "testing"
// New params path
func TestGetNetworkParameters(t *testing.T) {
p := GetDefaultNetwork()
expected := p.MaxCheckedRounds + 1
p.MaxCheckedRounds = expected
jsonString, err := p.Marshal()
if err != nil {
t.Errorf("%+v", err)
}
q, err := GetNetworkParameters(string(jsonString))
if err != nil {
t.Errorf("%+v", err)
}
if q.MaxCheckedRounds != expected {
t.Errorf("Parameters failed to change! Got %d, Expected %d", q.MaxCheckedRounds, expected)
}
}
// No new params path
func TestGetNetworkParameters_Default(t *testing.T) {
p := GetDefaultNetwork()
q, err := GetNetworkParameters("")
if err != nil {
t.Errorf("%+v", err)
}
if q.MaxCheckedRounds != p.MaxCheckedRounds {
t.Errorf("Parameters failed to change! Got %d, Expected %d", q.MaxCheckedRounds, p.MaxCheckedRounds)
}
}
File moved
////////////////////////////////////////////////////////////////////////////////
// Copyright © 2021 Privategrity Corporation /
// /
// All rights reserved. /
////////////////////////////////////////////////////////////////////////////////
package params
import "testing"
// New params path
func TestGetUnsafeParameters(t *testing.T) {
p := GetDefaultUnsafe()
expected := p.RoundTries + 1
p.RoundTries = expected
jsonString, err := p.Marshal()
if err != nil {
t.Errorf("%+v", err)
}
q, err := GetUnsafeParameters(string(jsonString))
if err != nil {
t.Errorf("%+v", err)
}
if q.RoundTries != expected {
t.Errorf("Parameters failed to change! Got %d, Expected %d", q.RoundTries, expected)
}
}
// No new params path
func TestGetUnsafeParameters_Default(t *testing.T) {
p := GetDefaultUnsafe()
q, err := GetUnsafeParameters("")
if err != nil {
t.Errorf("%+v", err)
}
if q.RoundTries != p.RoundTries {
t.Errorf("Parameters failed to change! Got %d, Expected %d", q.RoundTries, p.RoundTries)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment