package mongo

import (
	"encoding/json"
	"testing"
)

// A test to see if twe get the response form the database at all

func TestGetDTCFromMongo(t *testing.T){
	t.Skip()
	mg, err := GetPDXMongoClient()
	if err != nil{
		t.Error(err)
	}


	info, err := mg.GetDTCDefinitionByHexString("800156", "ACU")
	if err != nil {
		t.Error(err)
	}
	b, _ := json.Marshal(info)
	t.Log(string(b))
}

func TestGetLatestPDXVersions(t *testing.T){
	t.Skip()
	mg, err := GetPDXMongoClient()

	if err != nil{
		t.Error(err)
	}

	version, err := mg.GetLatestPDXVersions()
	if err != nil {
		t.Error(err)
	}
	if version.PDXVersion == ""{
		t.Fail()
	}
	t.Log(version)
}

func TestIsVersionNewer(t *testing.T){
	if !isVersionNewer("V1.2.3", "V2.3.4"){
		t.Log("V1.2.3", "V2.3.4")
		t.Fail()
	}

	if !isVersionNewer("V1.2.3", "V1.2.3.4"){
		t.Log("V1.2.3", "V1.2.3.4")
		t.Fail()
	}

	if isVersionNewer("V1.2.3.4", "V1.2.3"){
		t.Log("V1.2.3.4", "V1.2.3")
		t.Fail()
	}

	if isVersionNewer("V1.3.4", "V1.3.3.3"){
		t.Log("V1.3.4", "V1.3.3.3")
		t.Fail()
	}
}