package operator

import (
	"fmt"
	"testing"
)

func TestFilterIn(t *testing.T) {
	cases := map[string]struct {
		input  interface{}
		output interface{}
	}{
		"[]int{5} => []interface{5}": {
			input:  []int{5},
			output: []interface{}{5},
		},
		"[]string{} => nil": {
			input:  []string{},
			output: []interface{}{},
		},
		"[]interface{}{} => nil": {
			input:  []interface{}{},
			output: []interface{}{},
		},
		"[]interface{}{string} => []interface{string}": {
			input:  []interface{}{"hi"},
			output: []interface{}{"hi"},
		},
	}

	for name, d := range cases {
		c := d
		t.Run(name, func(t *testing.T) {
			filterIn := fmt.Sprint(NewFilterIn("key", c.input).Values)
			if want := fmt.Sprint(c.output); want != filterIn {
				t.Error(want, filterIn)
			}
		})
	}
}
