From c0cea013d1e40afef1664ac1ae49ba864a6340fc Mon Sep 17 00:00:00 2001 From: Francois Rompre-Lanctot Date: Wed, 18 Dec 2019 19:50:32 -0500 Subject: [PATCH] pgraph: Add test for SetValue function --- pgraph/pgraph_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pgraph/pgraph_test.go b/pgraph/pgraph_test.go index cc1c572f..f215db39 100644 --- a/pgraph/pgraph_test.go +++ b/pgraph/pgraph_test.go @@ -916,3 +916,21 @@ func TestFindEdge2(t *testing.T) { t.Errorf("an edge was found although it did not exist") } } + +func TestSetValue(t *testing.T) { + g, _ := NewGraph("SetValue") + + key := "k1" + value := "v1" + + g.SetValue(key, value) + if g.kv[key] != value { + t.Errorf("expecting value of %s at %s position, got %v", value, key, g.kv[key]) + } + + if v, ok := g.Value(key); !ok { + t.Errorf("key %s doesn't exist", key) + } else if v != value { + t.Errorf("expecting value of %s at %s position, got %v", value, key, v) + } +}