fix: added some unit tests for vm #8
@@ -9,12 +9,6 @@ var inputBuffer = buffer.NewInputBuffer()
|
|||||||
|
|
||||||
var statement = NewStatement()
|
var statement = NewStatement()
|
||||||
|
|
||||||
func comapareExpectedAndRetruned(t *testing.T, result, expectedResult PrepareResults, resultingStype, expectedStype statementType) {
|
|
||||||
if result != expectedResult && resultingStype == expectedStype {
|
|
||||||
t.Errorf("Expected prepareResult and stype to be: (%v, %v), got: (%v,%v)\n", expectedResult, expectedStype, result, resultingStype)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestVM(t *testing.T) {
|
func TestVM(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@@ -52,7 +46,9 @@ func TestVM(t *testing.T) {
|
|||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
inputBuffer.Buffer = test.input
|
inputBuffer.Buffer = test.input
|
||||||
result := statement.PrepareStatements(inputBuffer)
|
result := statement.PrepareStatements(inputBuffer)
|
||||||
comapareExpectedAndRetruned(t, result, test.prepareStatusExpected, statement.stype, test.statementResultExpected)
|
if result != test.prepareStatusExpected && statement.stype == test.statementResultExpected {
|
||||||
|
t.Errorf("Expected prepareResult and stype to be: (%v, %v), got: (%v,%v)\n", test.prepareStatusExpected, test.statementResultExpected, result, statement.stype)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user