Commit 7ff49e5c authored by Antoine Martin's avatar Antoine Martin Committed by Etienne Renault

ltl-desugar: rework tests

parent 80cabdab
......@@ -48,15 +48,18 @@ func TestSimpleVarExpand(t *testing.T) {
for i, test := range tests {
got, err := test.variable.Expand(test.aliases, "||")
if err != nil && !test.shouldFail {
t.Errorf("test %d returned an error: %v", i, err)
}
if err == nil && test.shouldFail {
t.Errorf("test %d didn't return an error: %v", i, err)
}
if got != test.expected {
t.Errorf("test %d: expected '%s', got '%s'", i, test.expected, got)
if test.shouldFail {
if err == nil {
t.Errorf("test %d didn't return an error: %v", i, err)
}
} else {
if err != nil {
t.Errorf("test %d returned an error: %v", i, err)
}
if got != test.expected {
t.Errorf("test %d: expected '%s', got '%s'", i, test.expected, got)
}
}
}
}
......@@ -88,15 +91,18 @@ func TestBoolExpressionExpand(t *testing.T) {
for i, test := range tests {
got, err := test.expr.Expand(test.aliases, "||")
if err != nil && !test.shouldFail {
t.Errorf("test %d returned an error: %v", i, err)
}
if err == nil && test.shouldFail {
t.Errorf("test %d didn't return an error: %v", i, err)
}
if got != test.expected {
t.Errorf("test %d: expected '%s', got '%s'", i, test.expected, got)
if test.shouldFail {
if err == nil {
t.Errorf("test %d didn't return an error: %v", i, err)
}
} else {
if err != nil {
t.Errorf("test %d returned an error: %v", i, err)
}
if got != test.expected {
t.Errorf("test %d: expected '%s', got '%s'", i, test.expected, got)
}
}
}
}
......@@ -130,15 +136,18 @@ func TestDesugar(t *testing.T) {
for i, test := range tests {
got, err := Desugar(test.formula, test.aliases)
if err != nil && !test.shouldFail {
t.Errorf("test %d returned an error: %v", i, err)
}
if err == nil && test.shouldFail {
t.Errorf("test %d didn't return an error: %v", i, err)
}
if got != test.expected {
t.Errorf("test %d: expected '%s', got '%s'", i, test.expected, got)
if test.shouldFail {
if err == nil {
t.Errorf("test %d didn't return an error: %v", i, err)
}
} else {
if err != nil {
t.Errorf("test %d returned an error: %v", i, err)
}
if got != test.expected {
t.Errorf("test %d: expected '%s', got '%s'", i, test.expected, got)
}
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment