github.com/jshiv/can-go@v0.2.1-0.20210224011015-069e90e90bdf/pkg/dbc/attributevaluetype_test.go (about)

     1  package dbc
     2  
     3  import (
     4  	"testing"
     5  
     6  	"gotest.tools/v3/assert"
     7  )
     8  
     9  func TestAttributeValueType_Validate(t *testing.T) {
    10  	for _, tt := range []AttributeValueType{
    11  		AttributeValueTypeInt,
    12  		AttributeValueTypeHex,
    13  		AttributeValueTypeFloat,
    14  		AttributeValueTypeString,
    15  		AttributeValueTypeEnum,
    16  	} {
    17  		assert.NilError(t, tt.Validate())
    18  	}
    19  }
    20  
    21  func TestAttributeValueType_Validate_Error(t *testing.T) {
    22  	assert.ErrorContains(t, AttributeValueType("foo").Validate(), "invalid attribute value type")
    23  }