diff options
Diffstat (limited to 'tests/functional/vector-builder-api')
l--------- | tests/functional/vector-builder-api/main.go | 1 | ||||
-rw-r--r-- | tests/functional/vector-builder-api/pds.go | 53 |
2 files changed, 54 insertions, 0 deletions
diff --git a/tests/functional/vector-builder-api/main.go b/tests/functional/vector-builder-api/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/functional/vector-builder-api/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/functional/vector-builder-api/pds.go b/tests/functional/vector-builder-api/pds.go new file mode 100644 index 0000000..6dd8c2f --- /dev/null +++ b/tests/functional/vector-builder-api/pds.go @@ -0,0 +1,53 @@ +package pds + +import ( + g "gobang" +) + + + +func MainTest() { + g.Testing("API usage", func() { + b1 := NewVectorBuilder[string]() + b1.Append("foo") + b1.Append("bar") + b1.Append("baz") + + l1 := b1.Vector() + g.TAssertEqual(l1.Get(0), "foo") + g.TAssertEqual(l1.Get(1), "bar") + g.TAssertEqual(l1.Get(2), "baz") + + + b2 := NewVectorBuilder[string]() + b2.Prepend("foo") + b2.Prepend("bar") + b2.Prepend("baz") + + l2 := b2.Vector() + g.TAssertEqual(l2.Get(0), "baz") + g.TAssertEqual(l2.Get(1), "bar") + g.TAssertEqual(l2.Get(2), "foo") + + + b3 := NewVectorBuilder[string]() + b3.Append("foo") + b3.Append("bar") + b3.Set(1, "___") + l3 := b3.Vector() + g.TAssertEqual(l3.Get(0), "foo") + g.TAssertEqual(l3.Get(1), "___") + + + b4 := NewVectorBuilder[string]() + b4.Append("foo") + b4.Append("bar") + b4.Append("baz") + b4.Slice(1, 3) + + l4 := b4.Vector() + g.TAssertEqual(l4.Len(), 2) + g.TAssertEqual(l4.Get(0), "bar") + g.TAssertEqual(l4.Get(1), "baz") + }) +} |