github.com/leanovate/gopter@v0.2.9/bi_mapper_test.go (about)

     1  package gopter_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/leanovate/gopter"
     7  )
     8  
     9  func TestBiMapperParamNotMatch(t *testing.T) {
    10  	defer expectPanic(t, "upstream has wrong parameter type 0: string != int")
    11  	gopter.NewBiMapper(func(int) int { return 0 }, func(string) int { return 0 })
    12  }
    13  
    14  func TestBiMapperReturnNotMatch(t *testing.T) {
    15  	defer expectPanic(t, "upstream has wrong return type 0: string != int")
    16  	gopter.NewBiMapper(func(int) int { return 0 }, func(int) string { return "" })
    17  }
    18  
    19  func TestBiMapperInvalidDownstream(t *testing.T) {
    20  	defer expectPanic(t, "downstream has to be a function")
    21  	gopter.NewBiMapper(1, 2)
    22  }
    23  
    24  func TestBiMapperInvalidUpstream(t *testing.T) {
    25  	defer expectPanic(t, "upstream has to be a function")
    26  	gopter.NewBiMapper(func(int) int { return 0 }, 2)
    27  }