From 342945dc4ff166517fb89e38f28e027e3b71f8c8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 22 Jan 2025 07:44:09 -0300 Subject: s/List/Vector/g --- tests/functional/list-api/main.go | 1 - tests/functional/list-api/pds.go | 61 ----------------------------- tests/functional/list-builder-api/main.go | 1 - tests/functional/list-builder-api/pds.go | 53 ------------------------- tests/functional/vector-api/main.go | 1 + tests/functional/vector-api/pds.go | 61 +++++++++++++++++++++++++++++ tests/functional/vector-builder-api/main.go | 1 + tests/functional/vector-builder-api/pds.go | 53 +++++++++++++++++++++++++ 8 files changed, 116 insertions(+), 116 deletions(-) delete mode 120000 tests/functional/list-api/main.go delete mode 100644 tests/functional/list-api/pds.go delete mode 120000 tests/functional/list-builder-api/main.go delete mode 100644 tests/functional/list-builder-api/pds.go create mode 120000 tests/functional/vector-api/main.go create mode 100644 tests/functional/vector-api/pds.go create mode 120000 tests/functional/vector-builder-api/main.go create mode 100644 tests/functional/vector-builder-api/pds.go (limited to 'tests/functional') diff --git a/tests/functional/list-api/main.go b/tests/functional/list-api/main.go deleted file mode 120000 index f67563d..0000000 --- a/tests/functional/list-api/main.go +++ /dev/null @@ -1 +0,0 @@ -../../main.go \ No newline at end of file diff --git a/tests/functional/list-api/pds.go b/tests/functional/list-api/pds.go deleted file mode 100644 index c4290c8..0000000 --- a/tests/functional/list-api/pds.go +++ /dev/null @@ -1,61 +0,0 @@ -package pds - -import ( - g "gobang" -) - - - -func MainTest() { - g.Testing("NewList() - API usage", func() { - l := NewList[string]().Append("foo").Append("bar").Append("baz") - g.TAssertEqual(l.Get(0), "foo") - g.TAssertEqual(l.Get(1), "bar") - g.TAssertEqual(l.Get(2), "baz") - - l = l.Prepend("a").Prepend("b").Prepend("c") - g.TAssertEqual(l.Get(0), "c") - g.TAssertEqual(l.Get(1), "b") - g.TAssertEqual(l.Get(2), "a") - - l = l.Set(0, "_") - g.TAssertEqual(l.Get(0), "_") - - l = l.Slice(1, 3) - g.TAssertEqual(l.Get(0), "b") - g.TAssertEqual(l.Get(1), "a") - g.TAssertEqual(l.Len(), 2) - }) - - g.Testing("NewList().Iterator() - API usage", func() { - l := NewList[string]() - l = l.Append("foo") - l = l.Append("bar") - l = l.Append("baz") - - indexes := []int{} - values := []string{} - itr := l.Iterator() - for !itr.Done() { - i, v := itr.Next() - indexes = append(indexes, i) - values = append(values, v) - } - itr.Last() - for !itr.Done() { - i, v := itr.Prev() - indexes = append(indexes, i) - values = append(values, v) - } - - g.TAssertEqual(indexes, []int{0, 1, 2, 2, 1, 0}) - g.TAssertEqual(values, []string{ - "foo", - "bar", - "baz", - "baz", - "bar", - "foo", - }) - }) -} diff --git a/tests/functional/list-builder-api/main.go b/tests/functional/list-builder-api/main.go deleted file mode 120000 index f67563d..0000000 --- a/tests/functional/list-builder-api/main.go +++ /dev/null @@ -1 +0,0 @@ -../../main.go \ No newline at end of file diff --git a/tests/functional/list-builder-api/pds.go b/tests/functional/list-builder-api/pds.go deleted file mode 100644 index c7b632c..0000000 --- a/tests/functional/list-builder-api/pds.go +++ /dev/null @@ -1,53 +0,0 @@ -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") - }) -} diff --git a/tests/functional/vector-api/main.go b/tests/functional/vector-api/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/functional/vector-api/main.go @@ -0,0 +1 @@ +../../main.go \ No newline at end of file diff --git a/tests/functional/vector-api/pds.go b/tests/functional/vector-api/pds.go new file mode 100644 index 0000000..aa37949 --- /dev/null +++ b/tests/functional/vector-api/pds.go @@ -0,0 +1,61 @@ +package pds + +import ( + g "gobang" +) + + + +func MainTest() { + g.Testing("NewVector() - API usage", func() { + l := NewVector[string]().Append("foo").Append("bar").Append("baz") + g.TAssertEqual(l.Get(0), "foo") + g.TAssertEqual(l.Get(1), "bar") + g.TAssertEqual(l.Get(2), "baz") + + l = l.Prepend("a").Prepend("b").Prepend("c") + g.TAssertEqual(l.Get(0), "c") + g.TAssertEqual(l.Get(1), "b") + g.TAssertEqual(l.Get(2), "a") + + l = l.Set(0, "_") + g.TAssertEqual(l.Get(0), "_") + + l = l.Slice(1, 3) + g.TAssertEqual(l.Get(0), "b") + g.TAssertEqual(l.Get(1), "a") + g.TAssertEqual(l.Len(), 2) + }) + + g.Testing("NewVector().Iterator() - API usage", func() { + l := NewVector[string]() + l = l.Append("foo") + l = l.Append("bar") + l = l.Append("baz") + + indexes := []int{} + values := []string{} + itr := l.Iterator() + for !itr.Done() { + i, v := itr.Next() + indexes = append(indexes, i) + values = append(values, v) + } + itr.Last() + for !itr.Done() { + i, v := itr.Prev() + indexes = append(indexes, i) + values = append(values, v) + } + + g.TAssertEqual(indexes, []int{0, 1, 2, 2, 1, 0}) + g.TAssertEqual(values, []string{ + "foo", + "bar", + "baz", + "baz", + "bar", + "foo", + }) + }) +} 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") + }) +} -- cgit v1.2.3