Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to '_test' package idiom #273

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions containers/containers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

// All data structures must implement the container structure

package containers
package containers_test

import (
"cmp"
"fmt"
"strings"
"testing"

"github.com/emirpasic/gods/v2/containers"
)

// For testing purposes
Expand Down Expand Up @@ -46,9 +48,9 @@ func (container ContainerTest[T]) String() string {

func TestGetSortedValuesInts(t *testing.T) {
container := ContainerTest[int]{}
GetSortedValues(container)
containers.GetSortedValues(container)
container.values = []int{5, 1, 3, 2, 4}
values := GetSortedValues(container)
values := containers.GetSortedValues(container)
for i := 1; i < container.Size(); i++ {
if values[i-1] > values[i] {
t.Errorf("Not sorted!")
Expand All @@ -62,11 +64,11 @@ type NotInt struct {

func TestGetSortedValuesNotInts(t *testing.T) {
container := ContainerTest[NotInt]{}
GetSortedValuesFunc(container, func(x, y NotInt) int {
containers.GetSortedValuesFunc(container, func(x, y NotInt) int {
return cmp.Compare(x.i, y.i)
})
container.values = []NotInt{{5}, {1}, {3}, {2}, {4}}
values := GetSortedValuesFunc(container, func(x, y NotInt) int {
values := containers.GetSortedValuesFunc(container, func(x, y NotInt) int {
return cmp.Compare(x.i, y.i)
})
for i := 1; i < container.Size(); i++ {
Expand Down
Loading