Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
26
pkg/dbc/models/dbc_collection_test.go
Normal file
26
pkg/dbc/models/dbc_collection_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDBCCollection_AddVersion(t *testing.T) {
|
||||
hash := "abcdef1234562"
|
||||
dbc := &DBCVersion{
|
||||
diagnosticFlags: map[int]map[string]float64{},
|
||||
state: map[int]CANMessageInterface{},
|
||||
}
|
||||
col := DBCCollection{}
|
||||
col.AddVersion(hash, dbc)
|
||||
d, err := col.Get(hash)
|
||||
assert.Equal(t, dbc, d)
|
||||
assert.Equal(t, nil, err)
|
||||
|
||||
hList := col.GetHashesList()
|
||||
assert.Equal(t, []string{hash}, hList)
|
||||
|
||||
oKey, err := col.GetOrigKey(GetShortKey(hash))
|
||||
assert.Equal(t, hash, oKey)
|
||||
assert.Equal(t, nil, err)
|
||||
}
|
||||
Reference in New Issue
Block a user