Java: Move summaryModel predicate, which constructs a CSV row to the testcode where it is used.

This commit is contained in:
Michael Nebel
2022-11-15 10:47:11 +01:00
parent 663d091776
commit 0abeb831c7
3 changed files with 26 additions and 26 deletions

View File

@@ -21,6 +21,26 @@ class TargetSummaryModelCsv extends Unit {
abstract predicate row(string r);
}
/** Holds if a summary model `row` exists for the given parameters. */
bindingset[row]
predicate summaryModelRow(
string package, string type, boolean subtypes, string name, string signature, string ext,
string input, string output, string kind, string provenance, string row
) {
summaryModel(package, type, subtypes, name, signature, ext, input, output, kind, provenance) and
row =
package + ";" //
+ type + ";" //
+ subtypes.toString() + ";" //
+ name + ";" //
+ signature + ";" //
+ ext + ";" //
+ input + ";" //
+ output + ";" //
+ kind + ";" //
+ provenance
}
/**
* Gets a CSV row for which a test has been requested, but `SummaryModelCsv.row` does not hold of it.
*/
@@ -64,8 +84,8 @@ private newtype TTestCase =
string inputSpec, string outputSpec
|
any(TargetSummaryModelCsv tsmc).row(row) and
summaryModel(namespace, type, subtypes, name, signature, ext, inputSpec, outputSpec, kind, _,
row) and
summaryModelRow(namespace, type, subtypes, name, signature, ext, inputSpec, outputSpec, kind,
_, row) and
callable = interpretElement(namespace, type, subtypes, name, signature, ext) and
Private::External::interpretSpec(inputSpec, input) and
Private::External::interpretSpec(outputSpec, output)

View File

@@ -21,25 +21,25 @@ query string getAParseFailure(string reason) {
any(TargetSummaryModelCsv target).row(result) and
any(SummaryModelCsv model).row(result) and
(
not summaryModel(_, _, _, _, _, _, _, _, _, _, result) and
not summaryModelRow(_, _, _, _, _, _, _, _, _, _, result) and
reason = "row could not be parsed"
or
exists(
string namespace, string type, boolean subtypes, string name, string signature, string ext
|
summaryModel(namespace, type, subtypes, name, signature, ext, _, _, _, _, result) and
summaryModelRow(namespace, type, subtypes, name, signature, ext, _, _, _, _, result) and
not interpretElement(namespace, type, subtypes, name, signature, ext) instanceof Callable and
reason = "callable could not be resolved"
)
or
exists(string inputSpec |
summaryModel(_, _, _, _, _, _, inputSpec, _, _, _, result) and
summaryModelRow(_, _, _, _, _, _, inputSpec, _, _, _, result) and
not Private::External::interpretSpec(inputSpec, _) and
reason = "input spec could not be parsed"
)
or
exists(string outputSpec |
summaryModel(_, _, _, _, _, _, _, outputSpec, _, _, result) and
summaryModelRow(_, _, _, _, _, _, _, outputSpec, _, _, result) and
not Private::External::interpretSpec(outputSpec, _) and
reason = "output spec could not be parsed"
)