diff options
author | EuAndreh <eu@euandre.org> | 2024-12-27 04:55:33 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-12-27 04:55:33 -0300 |
commit | 2764d269764e5c34c0d94ea58a5544692762560d (patch) | |
tree | b90c4bf1b9905566c00f9a7436c2cc79f1c8d843 /tests/functional/list-builder-api/pds.go | |
parent | Add Makefile and move files to structured folders (diff) | |
download | pds-2764d269764e5c34c0d94ea58a5544692762560d.tar.gz pds-2764d269764e5c34c0d94ea58a5544692762560d.tar.xz |
tests/pds.go: Move benchmarks and examples to separate test files
Diffstat (limited to 'tests/functional/list-builder-api/pds.go')
-rw-r--r-- | tests/functional/list-builder-api/pds.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/functional/list-builder-api/pds.go b/tests/functional/list-builder-api/pds.go new file mode 100644 index 0000000..c7b632c --- /dev/null +++ b/tests/functional/list-builder-api/pds.go @@ -0,0 +1,53 @@ +package pds + +import ( + g "gobang" +) + + + +func MainTest() { + g.Testing("API usage", func() { + b1 := NewListBuilder[string]() + b1.Append("foo") + b1.Append("bar") + b1.Append("baz") + + l1 := b1.List() + g.TAssertEqual(l1.Get(0), "foo") + g.TAssertEqual(l1.Get(1), "bar") + g.TAssertEqual(l1.Get(2), "baz") + + + b2 := NewListBuilder[string]() + b2.Prepend("foo") + b2.Prepend("bar") + b2.Prepend("baz") + + l2 := b2.List() + g.TAssertEqual(l2.Get(0), "baz") + g.TAssertEqual(l2.Get(1), "bar") + g.TAssertEqual(l2.Get(2), "foo") + + + b3 := NewListBuilder[string]() + b3.Append("foo") + b3.Append("bar") + b3.Set(1, "___") + l3 := b3.List() + g.TAssertEqual(l3.Get(0), "foo") + g.TAssertEqual(l3.Get(1), "___") + + + b4 := NewListBuilder[string]() + b4.Append("foo") + b4.Append("bar") + b4.Append("baz") + b4.Slice(1, 3) + + l4 := b4.List() + g.TAssertEqual(l4.Len(), 2) + g.TAssertEqual(l4.Get(0), "bar") + g.TAssertEqual(l4.Get(1), "baz") + }) +} |