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)
}
