(t *testing.T)
| 214 | } |
| 215 | |
| 216 | func TestUnifyExtendNegative(t *testing.T) { |
| 217 | tests := []struct { |
| 218 | name string |
| 219 | // The substitution that will be extended. |
| 220 | base map[ast.Variable]ast.BaseTerm |
| 221 | left []ast.BaseTerm |
| 222 | right []ast.BaseTerm |
| 223 | want map[ast.Variable]ast.BaseTerm |
| 224 | }{ |
| 225 | { |
| 226 | name: "unify fails, one exists", |
| 227 | base: map[ast.Variable]ast.BaseTerm{ |
| 228 | ast.Variable{"X"}: term("/c1"), |
| 229 | }, |
| 230 | left: []ast.BaseTerm{term("X")}, |
| 231 | right: []ast.BaseTerm{term("/c2")}, |
| 232 | }, |
| 233 | { |
| 234 | name: "unify fails two exist", |
| 235 | base: map[ast.Variable]ast.BaseTerm{ |
| 236 | ast.Variable{"X"}: term("/c1"), |
| 237 | ast.Variable{"Y"}: term("/c2"), |
| 238 | }, |
| 239 | left: []ast.BaseTerm{term("X")}, |
| 240 | right: []ast.BaseTerm{term("Y")}, |
| 241 | }, |
| 242 | } |
| 243 | for _, test := range tests { |
| 244 | // Prepare the substitution to be extended. |
| 245 | base, err := unionFindFromMap(test.base) |
| 246 | if err != nil { |
| 247 | t.Fatalf("error in test case: %s", test.name) |
| 248 | } |
| 249 | // Extend the substitution. |
| 250 | uf, err := UnifyTermsExtend(test.left, test.right, base) |
| 251 | if err == nil { // if NO error |
| 252 | t.Errorf("%s: UnifyTermsExtend(%v,%v,%v)=%v want error", test.name, test.left, test.right, base, uf) |
| 253 | } |
| 254 | } |
| 255 | } |
nothing calls this directly
no test coverage detected