File: subset_test.go

package info (click to toggle)
golang-github-thoas-go-funk 0.9.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 504 kB
  • sloc: makefile: 10
file content (34 lines) | stat: -rw-r--r-- 796 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package funk

import (
	"testing"
	"github.com/stretchr/testify/assert"
)

func TestSubset(t *testing.T) {
	is := assert.New(t)

	r := Subset([]int{1, 2, 4}, []int{1, 2, 3, 4, 5})
	is.True(r)

	r = Subset([]string{"foo", "bar"},[]string{"foo", "bar", "hello", "bar", "hi"})
	is.True(r)

	r = Subset([]string{"foo", "bar","extra"},[]string{"foo", "bar", "hello", "bar", "hi"})
	is.False(r)

	r = Subset([]string{"hello", "foo", "bar", "hello", "bar", "hi"}, []string{})
	is.False(r)
  
        r = Subset([]string{}, []string{"hello", "foo", "bar", "hello", "bar", "hi"})
	is.True(r)

	r = Subset([]string{}, []string{})
	is.True(r)

	r = Subset([]string{}, []string{"hello"})
	is.True(r)

	r = Subset([]string{"hello", "foo", "bar", "hello", "bar", "hi"}, []string{"foo", "bar"} )
	is.False(r)
}