File: bi_mapper_test.go

package info (click to toggle)
golang-github-leanovate-gopter 0.2.9%2Bgit20210201.bbbf00e-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 696 kB
  • sloc: makefile: 37
file content (27 lines) | stat: -rw-r--r-- 779 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
package gopter_test

import (
	"testing"

	"github.com/leanovate/gopter"
)

func TestBiMapperParamNotMatch(t *testing.T) {
	defer expectPanic(t, "upstream has wrong parameter type 0: string != int")
	gopter.NewBiMapper(func(int) int { return 0 }, func(string) int { return 0 })
}

func TestBiMapperReturnNotMatch(t *testing.T) {
	defer expectPanic(t, "upstream has wrong return type 0: string != int")
	gopter.NewBiMapper(func(int) int { return 0 }, func(int) string { return "" })
}

func TestBiMapperInvalidDownstream(t *testing.T) {
	defer expectPanic(t, "downstream has to be a function")
	gopter.NewBiMapper(1, 2)
}

func TestBiMapperInvalidUpstream(t *testing.T) {
	defer expectPanic(t, "upstream has to be a function")
	gopter.NewBiMapper(func(int) int { return 0 }, 2)
}