Browse Source

master > master: codego unit tests (actual, expected) Reihenfolge

master
RD 1 year ago
parent
commit
a20cfba970
  1. 56
      codego/aussagenlogik/rekursion/rekursion_test.go

56
codego/aussagenlogik/rekursion/rekursion_test.go

@ -26,19 +26,19 @@ func TestRekursivEvalLiteral(test *testing.T) {
tree = schema.ParseExpr("A0")
I = []string{"A0"}
go rekursion.RekursivEval(ch, tree, I)
assert.Equal(<-ch, 1)
assert.Equal(1, <-ch)
tree = schema.ParseExpr("A0")
I = []string{}
go rekursion.RekursivEval(ch, tree, I)
assert.Equal(<-ch, 0)
assert.Equal(0, <-ch)
tree = schema.ParseExpr("! A0")
I = []string{"A0"}
go rekursion.RekursivEval(ch, tree, I)
assert.Equal(<-ch, 0)
assert.Equal(0, <-ch)
tree = schema.ParseExpr("! A0")
I = []string{}
go rekursion.RekursivEval(ch, tree, I)
assert.Equal(<-ch, 1)
assert.Equal(1, <-ch)
}
func TestRekursivEvalComplex1(test *testing.T) {
@ -49,16 +49,16 @@ func TestRekursivEvalComplex1(test *testing.T) {
tree = schema.ParseExpr("( ! A0 || (( A0 && A3 ) || A2 ))")
I = []string{"A0", "A2"}
go rekursion.RekursivEval(ch, tree, I)
assert.Equal(<-ch, 1)
assert.Equal(1, <-ch)
I = []string{"A0", "A3"}
go rekursion.RekursivEval(ch, tree, I)
assert.Equal(<-ch, 1)
assert.Equal(1, <-ch)
I = []string{"A0"}
go rekursion.RekursivEval(ch, tree, I)
assert.Equal(<-ch, 0)
assert.Equal(0, <-ch)
I = []string{"A4", "A8"}
go rekursion.RekursivEval(ch, tree, I)
assert.Equal(<-ch, 1)
assert.Equal(1, <-ch)
}
func TestRekursivEvalComplex2(test *testing.T) {
@ -69,10 +69,10 @@ func TestRekursivEvalComplex2(test *testing.T) {
tree = schema.ParseExpr("( ! A0 || (( A0 && A3 ) || ! A2 ))")
I = []string{"A0", "A2"}
go rekursion.RekursivEval(ch, tree, I)
assert.Equal(<-ch, 0)
assert.Equal(0, <-ch)
I = []string{"A0", "A3"}
go rekursion.RekursivEval(ch, tree, I)
assert.Equal(<-ch, 1)
assert.Equal(1, <-ch)
}
/* ---------------------------------------------------------------- *
@ -89,7 +89,7 @@ func TestRekursivAtomsNoduplicates(test *testing.T) {
go rekursion.RekursivAtoms(ch, tree)
val = <-ch
var n int = len(utils.FilterStrings(&val, func(x string) bool { return x == "A4" }))
assert.Equal(n, 1, "Atome dürfen nicht mehrfach vorkommen!")
assert.Equal(1, n, "Atome dürfen nicht mehrfach vorkommen!")
}
func TestRekursivAtomsNononatoms(test *testing.T) {
@ -116,7 +116,7 @@ func TestRekursivAtomsCalc1(test *testing.T) {
go rekursion.RekursivAtoms(ch, tree)
val = <-ch
utils.SortStrings(&val)
assert.Equal(val, []string{"A0"})
assert.Equal([]string{"A0"}, val)
}
func TestRekursivAtomsCalc2(test *testing.T) {
@ -129,7 +129,7 @@ func TestRekursivAtomsCalc2(test *testing.T) {
go rekursion.RekursivAtoms(ch, tree)
val = <-ch
utils.SortStrings(&val)
assert.Equal(val, []string{"A0", "A3", "A4", "A8"})
assert.Equal([]string{"A0", "A3", "A4", "A8"}, val)
}
/* ---------------------------------------------------------------- *
@ -143,7 +143,7 @@ func TestRekursivDepthCalc1(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("A0")
go rekursion.RekursivDepth(ch, tree)
assert.Equal(<-ch, 0)
assert.Equal(0, <-ch)
}
func TestRekursivDepthCalc2(test *testing.T) {
@ -153,7 +153,7 @@ func TestRekursivDepthCalc2(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("!! A8")
go rekursion.RekursivDepth(ch, tree)
assert.Equal(<-ch, 2)
assert.Equal(2, <-ch)
}
func TestRekursivDepthCalc3(test *testing.T) {
@ -163,7 +163,7 @@ func TestRekursivDepthCalc3(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("( ! A0 && A3 )")
go rekursion.RekursivDepth(ch, tree)
assert.Equal(<-ch, 2)
assert.Equal(2, <-ch)
}
func TestRekursivDepthCalc4(test *testing.T) {
@ -173,7 +173,7 @@ func TestRekursivDepthCalc4(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("((( ! A0 && A3 ) || A4 ) && A8 )")
go rekursion.RekursivDepth(ch, tree)
assert.Equal(<-ch, 4)
assert.Equal(4, <-ch)
}
func TestRekursivDepthCalc5(test *testing.T) {
@ -183,7 +183,7 @@ func TestRekursivDepthCalc5(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("! ((( ! A0 && A3 ) || A4 ) && A8 )")
go rekursion.RekursivDepth(ch, tree)
assert.Equal(<-ch, 5)
assert.Equal(5, <-ch)
}
/* ---------------------------------------------------------------- *
@ -197,7 +197,7 @@ func TestRekursivLengthCalc1(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("A0")
go rekursion.RekursivLength(ch, tree)
assert.Equal(<-ch, 1)
assert.Equal(1, <-ch)
}
func TestRekursivLengthCalc2(test *testing.T) {
@ -207,7 +207,7 @@ func TestRekursivLengthCalc2(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("!! A8")
go rekursion.RekursivLength(ch, tree)
assert.Equal(<-ch, 3)
assert.Equal(3, <-ch)
}
func TestRekursivLengthCalc3(test *testing.T) {
@ -217,7 +217,7 @@ func TestRekursivLengthCalc3(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("( ! A0 && A3 )")
go rekursion.RekursivLength(ch, tree)
assert.Equal(<-ch, 4)
assert.Equal(4, <-ch)
}
func TestRekursivLengthCalc4(test *testing.T) {
@ -227,7 +227,7 @@ func TestRekursivLengthCalc4(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("((( ! A0 && A3 ) || A4 ) && A8 )")
go rekursion.RekursivLength(ch, tree)
assert.Equal(<-ch, 8)
assert.Equal(8, <-ch)
}
func TestRekursivLengthCalc5(test *testing.T) {
@ -237,7 +237,7 @@ func TestRekursivLengthCalc5(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("! ((( ! A0 && A3 ) || A4 ) && A8 )")
go rekursion.RekursivLength(ch, tree)
assert.Equal(<-ch, 9)
assert.Equal(9, <-ch)
}
/* ---------------------------------------------------------------- *
@ -251,7 +251,7 @@ func TestRekursivParenthesesCalc1(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("A0")
go rekursion.RekursivParentheses(ch, tree)
assert.Equal(<-ch, 0)
assert.Equal(0, <-ch)
}
func TestRekursivParenthesesCalc2(test *testing.T) {
@ -261,7 +261,7 @@ func TestRekursivParenthesesCalc2(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("!! A8")
go rekursion.RekursivParentheses(ch, tree)
assert.Equal(<-ch, 0)
assert.Equal(0, <-ch)
}
func TestRekursivParenthesesCalc3(test *testing.T) {
@ -271,7 +271,7 @@ func TestRekursivParenthesesCalc3(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("( ! A0 && A3 )")
go rekursion.RekursivParentheses(ch, tree)
assert.Equal(<-ch, 2)
assert.Equal(2, <-ch)
}
func TestRekursivParenthesesCalc4(test *testing.T) {
@ -281,7 +281,7 @@ func TestRekursivParenthesesCalc4(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("((( ! A0 && A3 ) || A4 ) && A8 )")
go rekursion.RekursivParentheses(ch, tree)
assert.Equal(<-ch, 6)
assert.Equal(6, <-ch)
}
func TestRekursivParenthesesCalc5(test *testing.T) {
@ -291,5 +291,5 @@ func TestRekursivParenthesesCalc5(test *testing.T) {
var tree syntaxbaum.SyntaxBaum
tree = schema.ParseExpr("! ((( ! A0 && A3 ) || A4 ) && A8 )")
go rekursion.RekursivParentheses(ch, tree)
assert.Equal(<-ch, 6)
assert.Equal(6, <-ch)
}

Loading…
Cancel
Save