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

     1  package gopter_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/leanovate/gopter"
     7  )
     8  
     9  func TestTestResult(t *testing.T) {
    10  	result := &gopter.TestResult{Status: gopter.TestPassed}
    11  	if !result.Passed() {
    12  		t.Errorf("Test not passed: %#v", result)
    13  	}
    14  	if result.Status.String() != "PASSED" {
    15  		t.Errorf("Invalid status: %#v", result)
    16  	}
    17  
    18  	result = &gopter.TestResult{Status: gopter.TestProved}
    19  	if !result.Passed() {
    20  		t.Errorf("Test not passed: %#v", result)
    21  	}
    22  	if result.Status.String() != "PROVED" {
    23  		t.Errorf("Invalid status: %#v", result)
    24  	}
    25  
    26  	result = &gopter.TestResult{Status: gopter.TestFailed}
    27  	if result.Passed() {
    28  		t.Errorf("Test passed: %#v", result)
    29  	}
    30  	if result.Status.String() != "FAILED" {
    31  		t.Errorf("Invalid status: %#v", result)
    32  	}
    33  
    34  	result = &gopter.TestResult{Status: gopter.TestExhausted}
    35  	if result.Passed() {
    36  		t.Errorf("Test passed: %#v", result)
    37  	}
    38  	if result.Status.String() != "EXHAUSTED" {
    39  		t.Errorf("Invalid status: %#v", result)
    40  	}
    41  
    42  	result = &gopter.TestResult{Status: gopter.TestError}
    43  	if result.Passed() {
    44  		t.Errorf("Test passed: %#v", result)
    45  	}
    46  	if result.Status.String() != "ERROR" {
    47  		t.Errorf("Invalid status: %#v", result)
    48  	}
    49  }