diff --git a/pkg/vector/bytes_test.go b/pkg/vector/bytes_test.go new file mode 100644 index 0000000000000000000000000000000000000000..50ed513e20479fcc5b5704d254190915e66170fe --- /dev/null +++ b/pkg/vector/bytes_test.go @@ -0,0 +1,21 @@ +package vector + +import ( + "testing" + + "github.com/DistributedClocks/GoVector/govec/vclock" + "github.com/stretchr/testify/assert" +) + +func TestBytes(t *testing.T) { + v := vclock.New() + v["A"] = 1 + v["B"] = 40 + v["C"] = 0 + v["D"] = 10 + + c, err := FromBytes(Bytes(v)) + + assert.NoError(t, err) + assert.True(t, v.Compare(c, vclock.Equal)) +} diff --git a/pkg/vector/print_test.go b/pkg/vector/print_test.go new file mode 100644 index 0000000000000000000000000000000000000000..811ee8ed665a37e537eacb34886b5cc71801c450 --- /dev/null +++ b/pkg/vector/print_test.go @@ -0,0 +1,18 @@ +package vector + +import ( + "testing" + + "github.com/DistributedClocks/GoVector/govec/vclock" + "github.com/stretchr/testify/assert" +) + +func TestSortedVCString(t *testing.T) { + v := vclock.New() + v["A"] = 1 + v["B"] = 40 + v["C"] = 0 + v["D"] = 10 + + assert.Equal(t, "{\"A\":1, \"B\":40, \"C\":0, \"D\":10}", SortedVCString(v)) +}