package collections_test

import (
	"testing"

	"github.com/google/go-cmp/cmp"

	"source.toby3d.me/toby3d/home/internal/templateutil/collections"
)

func TestNamespace_Seq(t *testing.T) {
	t.Parallel()

	for name, tc := range map[string]struct {
		input  []int
		expect []int
	}{
		"incremental":     {[]int{3}, []int{1, 2, 3}},
		"decremental":     {[]int{-3}, []int{-3, -2, -1}},
		"stepped":         {[]int{1, 2, 4}, []int{1, 3}},
		"positive-region": {[]int{1, 4}, []int{1, 2, 3, 4}},
		"negative-region": {[]int{1, -2}, []int{1, 0, -1, -2}},
	} {
		name, tc := name, tc

		t.Run(name, func(t *testing.T) {
			t.Parallel()

			actual, err := collections.New().Seq(tc.input...)
			if err != nil {
				t.Error(err)
			}

			if diff := cmp.Diff(tc.expect, actual); diff != "" {
				t.Error(diff)
			}
		})
	}
}
