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

     1  package gopter_test
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  
     7  	"github.com/leanovate/gopter"
     8  )
     9  
    10  func TestNewGenResult(t *testing.T) {
    11  	result := gopter.NewGenResult(123, gopter.NoShrinker)
    12  	value, ok := result.Retrieve()
    13  
    14  	if !ok || value != 123 || result.ResultType.Kind() != reflect.Int {
    15  		t.Errorf("Invalid result: %#v", value)
    16  	}
    17  }
    18  
    19  func TestNewEmptyResult(t *testing.T) {
    20  	result := gopter.NewEmptyResult(reflect.TypeOf(0))
    21  	value, ok := result.Retrieve()
    22  
    23  	if ok || value != nil || result.ResultType.Kind() != reflect.Int {
    24  		t.Errorf("Invalid result: %#v", value)
    25  	}
    26  }