Java: Refactor to avoid using SummaryModelCsv.

This commit is contained in:
Michael Nebel
2022-12-01 13:06:18 +01:00
parent d2c458c066
commit cd0d09d806
3 changed files with 10 additions and 10 deletions

View File

@@ -12,7 +12,7 @@ private import FlowTestCaseSupportMethods
/**
* A CSV row to generate tests for. Users should extend this to define which
* tests to generate. Rows specified here should also satisfy `SummaryModelCsv.row`.
* tests to generate. There should already exist a summaries for the rows specified here.
*/
class TargetSummaryModelCsv extends Unit {
/**
@@ -44,7 +44,7 @@ predicate summaryModelRow(
/**
* Gets a CSV row for which a test has been requested, but where a summary has not already been defined.
*/
query string missingSummaryModelCsv() {
query string missingSummaryModel() {
any(TargetSummaryModelCsv target).row(result) and
not summaryModelRow(_, _, _, _, _, _, _, _, _, _, result)
}

View File

@@ -173,9 +173,9 @@ def getTuples(queryName, jsonResult, fname):
with open(generatedJson, "r") as f:
generateOutput = json.load(f)
expectedTables = ("getTestCase", "getASupportMethodModel",
"missingSummaryModelCsv", "getAParseFailure", "noTestCaseGenerated")
"missingSummaryModel", "getAParseFailure", "noTestCaseGenerated")
testCaseRows, supportModelRows, missingSummaryModelCsvRows, parseFailureRows, noTestCaseGeneratedRows = \
testCaseRows, supportModelRows, missingSummaryModelRows, parseFailureRows, noTestCaseGeneratedRows = \
tuple([getTuples(k, generateOutput, generatedJson)
for k in expectedTables])
@@ -192,9 +192,9 @@ with open(generatedJson, "r") as f:
print("Expected exactly one column in noTestCaseGenerated relation (got: %s)" %
json.dumps(noTestCaseGeneratedRows), file=sys.stderr)
if len(missingSummaryModelCsvRows) != 0:
print("Tests for some CSV rows were requested that were not in scope (SummaryModelCsv.row does not hold):\n" +
"\n".join(r[0] for r in missingSummaryModelCsvRows))
if len(missingSummaryModelRows) != 0:
print("Tests for some CSV rows were requested that were not in scope (a summary doesn't already exist):\n" +
"\n".join(r[0] for r in missingSummaryModelRows))
sys.exit(1)
if len(parseFailureRows) != 0:
print("The following rows failed to generate any test case. Check package, class and method name spelling, and argument and result specifications:\n%s" %

View File

@@ -13,13 +13,13 @@ private import FlowTestCaseSupportMethods
private import FlowTestCaseUtils
/**
* Gets a CSV row for which a test has been requested, and `SummaryModelCsv.row` does hold, but
* Gets a CSV row for which a test has been requested, and where there exist a summary, but
* nonetheless we can't generate a test case for it, indicating we cannot resolve either the callable
* spec or an input or output spec.
*/
query string getAParseFailure(string reason) {
any(TargetSummaryModelCsv target).row(result) and
any(SummaryModelCsv model).row(result) and
summaryModelRow(_, _, _, _, _, _, _, _, _, _, result) and
(
not summaryModelRow(_, _, _, _, _, _, _, _, _, _, result) and
reason = "row could not be parsed"
@@ -52,7 +52,7 @@ query string getAParseFailure(string reason) {
*/
query string noTestCaseGenerated() {
any(TargetSummaryModelCsv target).row(result) and
any(SummaryModelCsv model).row(result) and
summaryModelRow(_, _, _, _, _, _, _, _, _, _, result) and
not exists(getAParseFailure(_)) and
not exists(any(TestCase tc).getATestSnippetForRow(result))
}