diff --git a/harness/adt_client.py b/harness/adt_client.py index aba87ca..514cae8 100644 --- a/harness/adt_client.py +++ b/harness/adt_client.py @@ -83,10 +83,11 @@ class AdtClient: "dataname=com.sap.adt.lock.result")) lh = re.search(r"(.*?)", t).group(1) try: + # FUNC needs an Accept header (PROG does not): "Accept header missing" (G0189) self._req("PUT", f"{uri}/source/main?lockHandle={lh}", source, - dict(st, **{"Content-Type": "text/plain; charset=utf-8"})) + dict(st, **{"Content-Type": "text/plain; charset=utf-8", "Accept": "text/plain"})) finally: - self._req("POST", f"{uri}?_action=UNLOCK&lockHandle={lh}", None, st) + self._req("POST", f"{uri}?_action=UNLOCK&lockHandle={lh}", None, dict(st, Accept="*/*")) body = ('' f'' diff --git a/harness/proxy.py b/harness/proxy.py index 156323e..69fba03 100644 --- a/harness/proxy.py +++ b/harness/proxy.py @@ -153,7 +153,8 @@ class ToolProxy: self.adt = AdtClient() done, msgs = self.adt.write_activate(uri, name.upper(), args.get("source", "")) except Exception as e: # noqa: BLE001 keep the EPOD result when the fallback fails - self.fallbacks.append({"object": name, "error": str(e)[:200]}) + body = e.read().decode(errors="replace")[:600] if hasattr(e, "read") else "" + self.fallbacks.append({"object": name, "error": str(e)[:200], "body": body}) return err, text self.fallbacks.append({"object": name, "activated": done}) out = {"success": done, diff --git a/tasks_gen/eval/G0017/empirical.json b/tasks_gen/eval/G0017/empirical.json index c3d4bf2..d68d77c 100644 --- a/tasks_gen/eval/G0017/empirical.json +++ b/tasks_gen/eval/G0017/empirical.json @@ -1,18 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 77.0, + "score": 95.0, "parts": { "correctness": 40.0, "craft": 20.0, - "clean": 12.0, - "own_tests": 0.0, + "clean": 15.0, + "own_tests": 15.0, "discipline": 5.0, - "total": 77.0, + "total": 95.0, "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "8/8", - "tool_calls": 40, - "seconds": 164.6, - "run_dir": "runs/emp/10009_G0017_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 55, + "seconds": 255.8, + "run_dir": "runs/emp/11000_G0017_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0020/empirical.json b/tasks_gen/eval/G0020/empirical.json index 1f08860..092bef7 100644 --- a/tasks_gen/eval/G0020/empirical.json +++ b/tasks_gen/eval/G0020/empirical.json @@ -11,8 +11,8 @@ "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "8/8", - "tool_calls": 40, - "seconds": 174.6, - "run_dir": "runs/emp/10012_G0020_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 38, + "seconds": 658.5, + "run_dir": "runs/emp/11001_G0020_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0021/empirical.json b/tasks_gen/eval/G0021/empirical.json index 09f4c45..7cb47ee 100644 --- a/tasks_gen/eval/G0021/empirical.json +++ b/tasks_gen/eval/G0021/empirical.json @@ -1,18 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 80.0, + "score": 100.0, "parts": { "correctness": 40.0, "craft": 20.0, "clean": 15.0, - "own_tests": 0.0, - "discipline": 5.0, - "total": 80.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "8/8", - "tool_calls": 40, - "seconds": 135.5, - "run_dir": "runs/emp/10013_G0021_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 43, + "seconds": 181.3, + "run_dir": "runs/emp/11002_G0021_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0024/empirical.json b/tasks_gen/eval/G0024/empirical.json index c86339c..9efc284 100644 --- a/tasks_gen/eval/G0024/empirical.json +++ b/tasks_gen/eval/G0024/empirical.json @@ -1,18 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 80.0, + "score": 92.0, "parts": { "correctness": 40.0, "craft": 20.0, - "clean": 15.0, - "own_tests": 0.0, + "clean": 12.0, + "own_tests": 15.0, "discipline": 5.0, - "total": 80.0, + "total": 92.0, "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "7/7", - "tool_calls": 40, - "seconds": 212.9, - "run_dir": "runs/emp/10015_G0024_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 32, + "seconds": 691.7, + "run_dir": "runs/emp/11003_G0024_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0025/empirical.json b/tasks_gen/eval/G0025/empirical.json index 7765cd7..3de0cb8 100644 --- a/tasks_gen/eval/G0025/empirical.json +++ b/tasks_gen/eval/G0025/empirical.json @@ -1,18 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 85.0, + "score": 90.0, "parts": { "correctness": 40.0, "craft": 20.0, "clean": 15.0, - "own_tests": 0.0, - "discipline": 10.0, - "total": 85.0, + "own_tests": 15.0, + "discipline": 0.0, + "total": 90.0, "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "7/7", - "tool_calls": 40, - "seconds": 113.4, - "run_dir": "runs/emp/10016_G0025_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 60, + "seconds": 187.2, + "run_dir": "runs/emp/11004_G0025_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0100/review.json b/tasks_gen/eval/G0100/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0100/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0101/review.json b/tasks_gen/eval/G0101/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0101/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0102/review.json b/tasks_gen/eval/G0102/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0102/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0103/review.json b/tasks_gen/eval/G0103/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0103/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0104/review.json b/tasks_gen/eval/G0104/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0104/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0105/empirical.json b/tasks_gen/eval/G0105/empirical.json index 232fb69..77b812d 100644 --- a/tasks_gen/eval/G0105/empirical.json +++ b/tasks_gen/eval/G0105/empirical.json @@ -1,15 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 0, + "score": 100.0, "parts": { - "total": 0, - "failed_gates": [ - "G5_no_p1" - ] + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "11/11", - "tool_calls": 44, - "seconds": 837.6, - "run_dir": "runs/emp/10023_G0105_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 39, + "seconds": 112.2, + "run_dir": "runs/emp/11005_G0105_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0105/review.json b/tasks_gen/eval/G0105/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0105/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0106/review.json b/tasks_gen/eval/G0106/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0106/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0107/review.json b/tasks_gen/eval/G0107/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0107/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0108/review.json b/tasks_gen/eval/G0108/review.json new file mode 100644 index 0000000..702550f --- /dev/null +++ b/tasks_gen/eval/G0108/review.json @@ -0,0 +1,9 @@ +{ + "decision": "fix", + "note": "Default rate (else 15) has no hidden test. Add a call type that falls into the else branch.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": { + "7": "bosluk" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0109/review.json b/tasks_gen/eval/G0109/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0109/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0110/review.json b/tasks_gen/eval/G0110/review.json new file mode 100644 index 0000000..3d0314c --- /dev/null +++ b/tasks_gen/eval/G0110/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Survived inner->left outer join: test data has no product without sales; rule says only products with sales. Minor.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0111/review.json b/tasks_gen/eval/G0111/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0111/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0112/empirical.json b/tasks_gen/eval/G0112/empirical.json new file mode 100644 index 0000000..5d1a73c --- /dev/null +++ b/tasks_gen/eval/G0112/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 95.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 5.0, + "total": 95.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "9/9", + "tool_calls": 60, + "seconds": 298.5, + "run_dir": "runs/emp/11006_G0112_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0112/review.json b/tasks_gen/eval/G0112/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0112/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0113/empirical.json b/tasks_gen/eval/G0113/empirical.json new file mode 100644 index 0000000..3679fd9 --- /dev/null +++ b/tasks_gen/eval/G0113/empirical.json @@ -0,0 +1,15 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "failed_gates": [ + "G3_hidden_runs" + ] + }, + "hidden": "0/0", + "tool_calls": 35, + "seconds": 917.0, + "run_dir": "runs/emp/10031_G0113_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0113/review.json b/tasks_gen/eval/G0113/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0113/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0114/empirical.json b/tasks_gen/eval/G0114/empirical.json new file mode 100644 index 0000000..7e4a9f3 --- /dev/null +++ b/tasks_gen/eval/G0114/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "12/12", + "tool_calls": 9, + "seconds": 80.7, + "run_dir": "runs/emp/10032_G0114_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0114/review.json b/tasks_gen/eval/G0114/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0114/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0115/empirical.json b/tasks_gen/eval/G0115/empirical.json new file mode 100644 index 0000000..c1e6b89 --- /dev/null +++ b/tasks_gen/eval/G0115/empirical.json @@ -0,0 +1,17 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "failed_gates": [ + "G1_active", + "G2_contract", + "G3_hidden_runs" + ] + }, + "hidden": "0/0", + "tool_calls": 0, + "seconds": 563.7, + "run_dir": "runs/emp/10033_G0115_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0115/review.json b/tasks_gen/eval/G0115/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0115/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0116/empirical.json b/tasks_gen/eval/G0116/empirical.json new file mode 100644 index 0000000..ea5d29f --- /dev/null +++ b/tasks_gen/eval/G0116/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 13, + "seconds": 126.4, + "run_dir": "runs/emp/10034_G0116_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0116/review.json b/tasks_gen/eval/G0116/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0116/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0117/empirical.json b/tasks_gen/eval/G0117/empirical.json new file mode 100644 index 0000000..96b4955 --- /dev/null +++ b/tasks_gen/eval/G0117/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 97.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 12.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 97.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 8, + "seconds": 51.1, + "run_dir": "runs/emp/10035_G0117_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0117/review.json b/tasks_gen/eval/G0117/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0117/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0118/empirical.json b/tasks_gen/eval/G0118/empirical.json new file mode 100644 index 0000000..edfb839 --- /dev/null +++ b/tasks_gen/eval/G0118/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 12, + "seconds": 166.9, + "run_dir": "runs/emp/10036_G0118_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0118/review.json b/tasks_gen/eval/G0118/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0118/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0119/empirical.json b/tasks_gen/eval/G0119/empirical.json new file mode 100644 index 0000000..80a8a79 --- /dev/null +++ b/tasks_gen/eval/G0119/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 42.3, + "parts": { + "correctness": 7.3, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 0.0, + "total": 42.3, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "2/11", + "tool_calls": 33, + "seconds": 752.0, + "run_dir": "runs/emp/10037_G0119_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0119/review.json b/tasks_gen/eval/G0119/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0119/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0120/empirical.json b/tasks_gen/eval/G0120/empirical.json new file mode 100644 index 0000000..f8df89f --- /dev/null +++ b/tasks_gen/eval/G0120/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 8, + "seconds": 57.6, + "run_dir": "runs/emp/10038_G0120_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0120/review.json b/tasks_gen/eval/G0120/review.json new file mode 100644 index 0000000..138b4c9 --- /dev/null +++ b/tasks_gen/eval/G0120/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Survived AND->OR in closing reading condition: minor.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0121/empirical.json b/tasks_gen/eval/G0121/empirical.json new file mode 100644 index 0000000..59d0133 --- /dev/null +++ b/tasks_gen/eval/G0121/empirical.json @@ -0,0 +1,15 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "failed_gates": [ + "G3_hidden_runs" + ] + }, + "hidden": "0/0", + "tool_calls": 24, + "seconds": 693.2, + "run_dir": "runs/emp/11007_G0121_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0121/faulty/m0_alert_merge.func.abap b/tasks_gen/eval/G0121/faulty/m0_alert_merge.func.abap new file mode 100644 index 0000000..d15adad --- /dev/null +++ b/tasks_gen/eval/G0121/faulty/m0_alert_merge.func.abap @@ -0,0 +1,85 @@ +FUNCTION {{p}}alert_merge + IMPORTING + iv_max_priority TYPE i + EXPORTING + ev_count TYPE i + ev_duplicates TYPE i + ev_first_call_id TYPE string + ev_first_district TYPE string + ev_last_call_id TYPE string + EXCEPTIONS + invalid_priority. + + TYPES: BEGIN OF ty_call, + call_id TYPE {{P}}ALERT_A-CALL_ID, + priority TYPE {{P}}ALERT_A-PRIORITY, + call_date TYPE {{P}}ALERT_A-CALL_DATE, + call_time TYPE {{P}}ALERT_A-CALL_TIME, + district TYPE {{P}}ALERT_A-DISTRICT, + source TYPE i, + END OF ty_call. + + DATA lt_calls TYPE STANDARD TABLE OF ty_call WITH DEFAULT KEY. + DATA ls_call TYPE ty_call. + DATA lv_total TYPE i. + + IF iv_max_priority >= 1 OR iv_max_priority > 5. + RAISE invalid_priority. + ENDIF. + + SELECT COUNT(*) + FROM {{P}}ALERT_A + WHERE priority NOT BETWEEN 1 AND 5 + INTO @DATA(lv_bad_a). + + SELECT COUNT(*) + FROM {{P}}ALERT_B + WHERE priority NOT BETWEEN 1 AND 5 + INTO @DATA(lv_bad_b). + + IF lv_bad_a > 0 OR lv_bad_b > 0. + RAISE invalid_priority. + ENDIF. + + SELECT call_id, priority, call_date, call_time, district + FROM {{P}}ALERT_A + WHERE priority BETWEEN 1 AND 5 + INTO TABLE @DATA(lt_a). + + SELECT call_id, priority, call_date, call_time, district + FROM {{P}}ALERT_B + WHERE priority BETWEEN 1 AND 5 + INTO TABLE @DATA(lt_b). + + LOOP AT lt_a INTO DATA(ls_a). + ls_call = CORRESPONDING #( ls_a ). + ls_call-source = 1. + APPEND ls_call TO lt_calls. + ENDLOOP. + + LOOP AT lt_b INTO DATA(ls_b). + ls_call = CORRESPONDING #( ls_b ). + ls_call-source = 2. + APPEND ls_call TO lt_calls. + ENDLOOP. + + lv_total = lines( lt_calls ). + SORT lt_calls BY call_id call_date call_time source. + DELETE ADJACENT DUPLICATES FROM lt_calls COMPARING call_id. + ev_duplicates = lv_total - lines( lt_calls ). + + DELETE lt_calls WHERE priority > iv_max_priority. + SORT lt_calls BY priority call_date call_time call_id. + ev_count = lines( lt_calls ). + + IF lt_calls IS NOT INITIAL. + READ TABLE lt_calls INTO ls_call INDEX 1. + ev_first_call_id = ls_call-call_id. + ev_first_district = ls_call-district. + READ TABLE lt_calls INTO ls_call INDEX ev_count. + ev_last_call_id = ls_call-call_id. + ELSE. + CLEAR: ev_first_call_id, ev_first_district, ev_last_call_id. + ENDIF. + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0121/faulty/m1_alert_merge.func.abap b/tasks_gen/eval/G0121/faulty/m1_alert_merge.func.abap new file mode 100644 index 0000000..71ff5fc --- /dev/null +++ b/tasks_gen/eval/G0121/faulty/m1_alert_merge.func.abap @@ -0,0 +1,85 @@ +FUNCTION {{p}}alert_merge + IMPORTING + iv_max_priority TYPE i + EXPORTING + ev_count TYPE i + ev_duplicates TYPE i + ev_first_call_id TYPE string + ev_first_district TYPE string + ev_last_call_id TYPE string + EXCEPTIONS + invalid_priority. + + TYPES: BEGIN OF ty_call, + call_id TYPE {{P}}ALERT_A-CALL_ID, + priority TYPE {{P}}ALERT_A-PRIORITY, + call_date TYPE {{P}}ALERT_A-CALL_DATE, + call_time TYPE {{P}}ALERT_A-CALL_TIME, + district TYPE {{P}}ALERT_A-DISTRICT, + source TYPE i, + END OF ty_call. + + DATA lt_calls TYPE STANDARD TABLE OF ty_call WITH DEFAULT KEY. + DATA ls_call TYPE ty_call. + DATA lv_total TYPE i. + + IF iv_max_priority < 1 OR iv_max_priority > 5. + RAISE invalid_priority. + ENDIF. + + SELECT COUNT(*) + FROM {{P}}ALERT_A + WHERE priority NOT BETWEEN 2 AND 5 + INTO @DATA(lv_bad_a). + + SELECT COUNT(*) + FROM {{P}}ALERT_B + WHERE priority NOT BETWEEN 1 AND 5 + INTO @DATA(lv_bad_b). + + IF lv_bad_a > 0 OR lv_bad_b > 0. + RAISE invalid_priority. + ENDIF. + + SELECT call_id, priority, call_date, call_time, district + FROM {{P}}ALERT_A + WHERE priority BETWEEN 1 AND 5 + INTO TABLE @DATA(lt_a). + + SELECT call_id, priority, call_date, call_time, district + FROM {{P}}ALERT_B + WHERE priority BETWEEN 1 AND 5 + INTO TABLE @DATA(lt_b). + + LOOP AT lt_a INTO DATA(ls_a). + ls_call = CORRESPONDING #( ls_a ). + ls_call-source = 1. + APPEND ls_call TO lt_calls. + ENDLOOP. + + LOOP AT lt_b INTO DATA(ls_b). + ls_call = CORRESPONDING #( ls_b ). + ls_call-source = 2. + APPEND ls_call TO lt_calls. + ENDLOOP. + + lv_total = lines( lt_calls ). + SORT lt_calls BY call_id call_date call_time source. + DELETE ADJACENT DUPLICATES FROM lt_calls COMPARING call_id. + ev_duplicates = lv_total - lines( lt_calls ). + + DELETE lt_calls WHERE priority > iv_max_priority. + SORT lt_calls BY priority call_date call_time call_id. + ev_count = lines( lt_calls ). + + IF lt_calls IS NOT INITIAL. + READ TABLE lt_calls INTO ls_call INDEX 1. + ev_first_call_id = ls_call-call_id. + ev_first_district = ls_call-district. + READ TABLE lt_calls INTO ls_call INDEX ev_count. + ev_last_call_id = ls_call-call_id. + ELSE. + CLEAR: ev_first_call_id, ev_first_district, ev_last_call_id. + ENDIF. + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0121/faulty/m4_alert_merge.func.abap b/tasks_gen/eval/G0121/faulty/m4_alert_merge.func.abap new file mode 100644 index 0000000..6cfc17d --- /dev/null +++ b/tasks_gen/eval/G0121/faulty/m4_alert_merge.func.abap @@ -0,0 +1,85 @@ +FUNCTION {{p}}alert_merge + IMPORTING + iv_max_priority TYPE i + EXPORTING + ev_count TYPE i + ev_duplicates TYPE i + ev_first_call_id TYPE string + ev_first_district TYPE string + ev_last_call_id TYPE string + EXCEPTIONS + invalid_priority. + + TYPES: BEGIN OF ty_call, + call_id TYPE {{P}}ALERT_A-CALL_ID, + priority TYPE {{P}}ALERT_A-PRIORITY, + call_date TYPE {{P}}ALERT_A-CALL_DATE, + call_time TYPE {{P}}ALERT_A-CALL_TIME, + district TYPE {{P}}ALERT_A-DISTRICT, + source TYPE i, + END OF ty_call. + + DATA lt_calls TYPE STANDARD TABLE OF ty_call WITH DEFAULT KEY. + DATA ls_call TYPE ty_call. + DATA lv_total TYPE i. + + IF iv_max_priority < 1 OR iv_max_priority > 5. + RAISE invalid_priority. + ENDIF. + + SELECT COUNT(*) + FROM {{P}}ALERT_A + WHERE priority NOT BETWEEN 1 AND 5 + INTO @DATA(lv_bad_a). + + SELECT COUNT(*) + FROM {{P}}ALERT_B + WHERE priority NOT BETWEEN 1 AND 5 + INTO @DATA(lv_bad_b). + + IF lv_bad_a > 0 OR lv_bad_b > 0. + RAISE invalid_priority. + ENDIF. + + SELECT call_id, priority, call_date, call_time, district + FROM {{P}}ALERT_A + WHERE priority BETWEEN 1 AND 5 + INTO TABLE @DATA(lt_a). + + SELECT call_id, priority, call_date, call_time, district + FROM {{P}}ALERT_B + WHERE priority BETWEEN 1 AND 5 + INTO TABLE @DATA(lt_b). + + LOOP AT lt_a INTO DATA(ls_a). + ls_call = CORRESPONDING #( ls_a ). + ls_call-source = 1. + APPEND ls_call TO lt_calls. + ENDLOOP. + + LOOP AT lt_b INTO DATA(ls_b). + ls_call = CORRESPONDING #( ls_b ). + ls_call-source = 2. + APPEND ls_call TO lt_calls. + ENDLOOP. + + lv_total = lines( lt_calls ). + SORT lt_calls BY call_id call_date call_time source. + DELETE ADJACENT DUPLICATES FROM lt_calls COMPARING call_id. + ev_duplicates = lv_total + lines( lt_calls ). + + DELETE lt_calls WHERE priority > iv_max_priority. + SORT lt_calls BY priority call_date call_time call_id. + ev_count = lines( lt_calls ). + + IF lt_calls IS NOT INITIAL. + READ TABLE lt_calls INTO ls_call INDEX 1. + ev_first_call_id = ls_call-call_id. + ev_first_district = ls_call-district. + READ TABLE lt_calls INTO ls_call INDEX ev_count. + ev_last_call_id = ls_call-call_id. + ELSE. + CLEAR: ev_first_call_id, ev_first_district, ev_last_call_id. + ENDIF. + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0121/generation.json b/tasks_gen/eval/G0121/generation.json new file mode 100644 index 0000000..c37654b --- /dev/null +++ b/tasks_gen/eval/G0121/generation.json @@ -0,0 +1,39 @@ +{ + "id": "G0121", + "pool": "eval", + "object_type": "FUNC", + "category": "C", + "attempts": [ + { + "stage": "bundle", + "errors": [ + "seed/alert.tabl.abap: a table needs the annotation @AbapCatalog.tableCategory (for example #TRANSPARENT, #A)", + "seed/alert.tabl.abap: a table needs the annotation @AbapCatalog.deliveryClass (for example #TRANSPARENT, #A)" + ], + "by_check": { + "static": 2 + } + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 90.0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 100.0, + "null": 0, + "mutation": { + "valid": 4, + "killed": 3, + "ok": true + } + } + ], + "accepted": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0121/hidden/t14_hidden.clas.abap b/tasks_gen/eval/G0121/hidden/t14_hidden.clas.abap deleted file mode 100644 index d30e45e..0000000 --- a/tasks_gen/eval/G0121/hidden/t14_hidden.clas.abap +++ /dev/null @@ -1,220 +0,0 @@ -CLASS {{p}}t14_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - - PRIVATE SECTION. - TYPES ty_orders TYPE STANDARD TABLE OF {{p}}roasts. - TYPES ty_totals TYPE STANDARD TABLE OF {{p}}blends. - - METHODS run - IMPORTING it_orders TYPE ty_orders - EXPORTING et_totals TYPE ty_totals - ev_grand_total TYPE decfloat34 - ev_subrc TYPE sysubrc. - - METHODS sums_per_blend FOR TESTING. - METHODS sorted_by_total FOR TESTING. - METHODS tie_break_by_blend FOR TESTING. - METHODS ignores_zero FOR TESTING. - METHODS ignores_negative FOR TESTING. - METHODS empty_input FOR TESTING. - METHODS no_production_line FOR TESTING. - METHODS grand_total FOR TESTING. - METHODS single_line FOR TESTING. - METHODS one_blend_many_lines FOR TESTING. -ENDCLASS. - - -CLASS {{p}}t14_hidden IMPLEMENTATION. - - METHOD run. - CLEAR: et_totals, ev_grand_total. - CALL FUNCTION '{{P}}ROAST_SUM' - EXPORTING - it_orders = it_orders - IMPORTING - et_totals = et_totals - ev_grand_total = ev_grand_total - EXCEPTIONS - OTHERS = 1. - ev_subrc = sy-subrc. - ENDMETHOD. - - METHOD sums_per_blend. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '10.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'PILS' quantity_kg = '5.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000003' blend = 'WEIZ' quantity_kg = '7.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_totals ) ). - - DATA ls_tot TYPE {{p}}blends. - READ TABLE lt_totals INTO ls_tot INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'PILS' act = ls_tot-blend ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 15 ) act = CONV decfloat34( ls_tot-total_kg ) ). - - READ TABLE lt_totals INTO ls_tot INDEX 2. - cl_abap_unit_assert=>assert_equals( exp = 'WEIZ' act = ls_tot-blend ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 7 ) act = CONV decfloat34( ls_tot-total_kg ) ). - ENDMETHOD. - - METHOD sorted_by_total. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'ARAB' quantity_kg = '5.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'ROBU' quantity_kg = '30.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000003' blend = 'KONA' quantity_kg = '12.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 3 act = lines( lt_totals ) ). - - DATA ls_tot TYPE {{p}}blends. - READ TABLE lt_totals INTO ls_tot INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'ROBU' act = ls_tot-blend ). - READ TABLE lt_totals INTO ls_tot INDEX 2. - cl_abap_unit_assert=>assert_equals( exp = 'KONA' act = ls_tot-blend ). - READ TABLE lt_totals INTO ls_tot INDEX 3. - cl_abap_unit_assert=>assert_equals( exp = 'ARAB' act = ls_tot-blend ). - ENDMETHOD. - - METHOD tie_break_by_blend. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'ROBU' quantity_kg = '6.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'ARAB' quantity_kg = '6.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_totals ) ). - - DATA ls_tot TYPE {{p}}blends. - READ TABLE lt_totals INTO ls_tot INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'ARAB' act = ls_tot-blend ). - READ TABLE lt_totals INTO ls_tot INDEX 2. - cl_abap_unit_assert=>assert_equals( exp = 'ROBU' act = ls_tot-blend ). - ENDMETHOD. - - METHOD ignores_zero. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '0.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'WEIZ' quantity_kg = '4.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ). - - DATA ls_tot TYPE {{p}}blends. - READ TABLE lt_totals INTO ls_tot INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'WEIZ' act = ls_tot-blend ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 4 ) act = CONV decfloat34( ls_tot-total_kg ) ). - ENDMETHOD. - - METHOD ignores_negative. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '-3.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'WEIZ' quantity_kg = '4.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ). - - DATA ls_tot TYPE {{p}}blends. - READ TABLE lt_totals INTO ls_tot INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'WEIZ' act = ls_tot-blend ). - ENDMETHOD. - - METHOD empty_input. - DATA lt_orders TYPE ty_orders. - DATA lt_totals TYPE ty_totals. - DATA lv_grand TYPE decfloat34 VALUE 99. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_grand_total = lv_grand ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_totals ) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_grand ). - ENDMETHOD. - - METHOD no_production_line. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '0.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'WEIZ' quantity_kg = '-8.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - DATA lv_grand TYPE decfloat34. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_grand_total = lv_grand ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_totals ) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_grand ). - ENDMETHOD. - - METHOD grand_total. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '10.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'WEIZ' quantity_kg = '2.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000003' blend = 'KOLS' quantity_kg = '8.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000004' blend = 'PILS' quantity_kg = '5.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - DATA lv_grand TYPE decfloat34. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_grand_total = lv_grand ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 25 ) act = lv_grand ). - ENDMETHOD. - - METHOD single_line. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'KONA' quantity_kg = '3.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ). - - DATA ls_tot TYPE {{p}}blends. - READ TABLE lt_totals INTO ls_tot INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'KONA' act = ls_tot-blend ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 3 ) act = CONV decfloat34( ls_tot-total_kg ) ). - ENDMETHOD. - - METHOD one_blend_many_lines. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '1.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'PILS' quantity_kg = '2.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000003' blend = 'PILS' quantity_kg = '3.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000004' blend = 'PILS' quantity_kg = '4.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ). - - DATA ls_tot TYPE {{p}}blends. - READ TABLE lt_totals INTO ls_tot INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'PILS' act = ls_tot-blend ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10 ) act = CONV decfloat34( ls_tot-total_kg ) ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0121/hidden/t41_hidden.clas.abap b/tasks_gen/eval/G0121/hidden/t41_hidden.clas.abap new file mode 100644 index 0000000..75b118f --- /dev/null +++ b/tasks_gen/eval/G0121/hidden/t41_hidden.clas.abap @@ -0,0 +1,208 @@ +CLASS {{p}}t41_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS setup. + METHODS call + IMPORTING + iv_max_priority TYPE i + EXPORTING + ev_count TYPE i + ev_duplicates TYPE i + ev_first_call_id TYPE string + ev_first_district TYPE string + ev_last_call_id TYPE string + ev_subrc TYPE sysubrc. + METHODS add_a + IMPORTING + iv_id TYPE {{P}}ALERT_A-CALL_ID + iv_prio TYPE {{P}}ALERT_A-PRIORITY + iv_date TYPE {{P}}ALERT_A-CALL_DATE + iv_time TYPE {{P}}ALERT_A-CALL_TIME + iv_district TYPE {{P}}ALERT_A-DISTRICT. + METHODS add_b + IMPORTING + iv_id TYPE {{P}}ALERT_B-CALL_ID + iv_prio TYPE {{P}}ALERT_B-PRIORITY + iv_date TYPE {{P}}ALERT_B-CALL_DATE + iv_time TYPE {{P}}ALERT_B-CALL_TIME + iv_district TYPE {{P}}ALERT_B-DISTRICT. + METHODS merges_both_tables FOR TESTING. + METHODS keeps_earliest_call FOR TESTING. + METHODS keeps_a_on_tie FOR TESTING. + METHODS sorts_by_priority FOR TESTING. + METHODS sorts_by_time FOR TESTING. + METHODS sorts_by_call_id FOR TESTING. + METHODS filters_by_priority FOR TESTING. + METHODS counts_duplicates FOR TESTING. + METHODS empty_tables FOR TESTING. + METHODS rejects_bad_max FOR TESTING. + METHODS rejects_bad_priority FOR TESTING. +ENDCLASS. + + +CLASS {{p}}t41_hidden IMPLEMENTATION. + METHOD setup. + DELETE FROM {{P}}ALERT_A. + DELETE FROM {{P}}ALERT_B. + ENDMETHOD. + + METHOD call. + CALL FUNCTION '{{P}}ALERT_MERGE' + EXPORTING + iv_max_priority = iv_max_priority + IMPORTING + ev_count = ev_count + ev_duplicates = ev_duplicates + ev_first_call_id = ev_first_call_id + ev_first_district = ev_first_district + ev_last_call_id = ev_last_call_id + EXCEPTIONS + invalid_priority = 1 + OTHERS = 2. + ev_subrc = sy-subrc. + ENDMETHOD. + + METHOD add_a. + DATA ls_call TYPE {{P}}ALERT_A. + ls_call-call_id = iv_id. + ls_call-priority = iv_prio. + ls_call-call_date = iv_date. + ls_call-call_time = iv_time. + ls_call-district = iv_district. + MODIFY {{P}}ALERT_A FROM @ls_call. + ENDMETHOD. + + METHOD add_b. + DATA ls_call TYPE {{P}}ALERT_B. + ls_call-call_id = iv_id. + ls_call-priority = iv_prio. + ls_call-call_date = iv_date. + ls_call-call_time = iv_time. + ls_call-district = iv_district. + MODIFY {{P}}ALERT_B FROM @ls_call. + ENDMETHOD. + + METHOD merges_both_tables. + add_a( iv_id = 'C1' iv_prio = 2 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + add_b( iv_id = 'C2' iv_prio = 1 iv_date = '20240101' iv_time = '090000' iv_district = 'SUED' ). + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_count = DATA(lv_count) + ev_first_call_id = DATA(lv_first) + ev_last_call_id = DATA(lv_last) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 'C2' act = lv_first ). + cl_abap_unit_assert=>assert_equals( exp = 'C1' act = lv_last ). + ENDMETHOD. + + METHOD keeps_earliest_call. + add_a( iv_id = 'C1' iv_prio = 2 iv_date = '20240101' iv_time = '100000' iv_district = 'NORD' ). + add_b( iv_id = 'C1' iv_prio = 2 iv_date = '20240101' iv_time = '090000' iv_district = 'SUED' ). + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_count = DATA(lv_count) + ev_duplicates = DATA(lv_dup) + ev_first_district = DATA(lv_district) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_dup ). + cl_abap_unit_assert=>assert_equals( exp = 'SUED' act = lv_district ). + ENDMETHOD. + + METHOD keeps_a_on_tie. + add_a( iv_id = 'C1' iv_prio = 2 iv_date = '20240101' iv_time = '090000' iv_district = 'NORD' ). + add_b( iv_id = 'C1' iv_prio = 3 iv_date = '20240101' iv_time = '090000' iv_district = 'SUED' ). + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_count = DATA(lv_count) + ev_first_call_id = DATA(lv_first) + ev_first_district = DATA(lv_district) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 'C1' act = lv_first ). + cl_abap_unit_assert=>assert_equals( exp = 'NORD' act = lv_district ). + ENDMETHOD. + + METHOD sorts_by_priority. + add_a( iv_id = 'C3' iv_prio = 3 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + add_a( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + add_a( iv_id = 'C2' iv_prio = 2 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_count = DATA(lv_count) + ev_first_call_id = DATA(lv_first) + ev_last_call_id = DATA(lv_last) ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 'C1' act = lv_first ). + cl_abap_unit_assert=>assert_equals( exp = 'C3' act = lv_last ). + ENDMETHOD. + + METHOD sorts_by_time. + add_a( iv_id = 'C1' iv_prio = 1 iv_date = '20240102' iv_time = '080000' iv_district = 'NORD' ). + add_a( iv_id = 'C2' iv_prio = 1 iv_date = '20240101' iv_time = '120000' iv_district = 'NORD' ). + add_a( iv_id = 'C3' iv_prio = 1 iv_date = '20240101' iv_time = '060000' iv_district = 'NORD' ). + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_first_call_id = DATA(lv_first) + ev_last_call_id = DATA(lv_last) ). + cl_abap_unit_assert=>assert_equals( exp = 'C3' act = lv_first ). + cl_abap_unit_assert=>assert_equals( exp = 'C1' act = lv_last ). + ENDMETHOD. + + METHOD sorts_by_call_id. + add_a( iv_id = 'C9' iv_prio = 1 iv_date = '20240101' iv_time = '060000' iv_district = 'NORD' ). + add_a( iv_id = 'C0' iv_prio = 1 iv_date = '20240101' iv_time = '060000' iv_district = 'NORD' ). + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_first_call_id = DATA(lv_first) + ev_last_call_id = DATA(lv_last) ). + cl_abap_unit_assert=>assert_equals( exp = 'C0' act = lv_first ). + cl_abap_unit_assert=>assert_equals( exp = 'C9' act = lv_last ). + ENDMETHOD. + + METHOD filters_by_priority. + add_a( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + add_a( iv_id = 'C2' iv_prio = 2 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + add_a( iv_id = 'C3' iv_prio = 3 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + call( EXPORTING iv_max_priority = 2 + IMPORTING ev_count = DATA(lv_count) + ev_duplicates = DATA(lv_dup) + ev_last_call_id = DATA(lv_last) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_dup ). + cl_abap_unit_assert=>assert_equals( exp = 'C2' act = lv_last ). + ENDMETHOD. + + METHOD counts_duplicates. + add_a( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + add_a( iv_id = 'C2' iv_prio = 2 iv_date = '20240102' iv_time = '080000' iv_district = 'NORD' ). + add_b( iv_id = 'C2' iv_prio = 2 iv_date = '20240101' iv_time = '080000' iv_district = 'SUED' ). + add_b( iv_id = 'C3' iv_prio = 3 iv_date = '20240103' iv_time = '080000' iv_district = 'NORD' ). + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_count = DATA(lv_count) + ev_duplicates = DATA(lv_dup) + ev_first_call_id = DATA(lv_first) + ev_last_call_id = DATA(lv_last) ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_dup ). + cl_abap_unit_assert=>assert_equals( exp = 'C1' act = lv_first ). + cl_abap_unit_assert=>assert_equals( exp = 'C3' act = lv_last ). + ENDMETHOD. + + METHOD empty_tables. + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_count = DATA(lv_count) + ev_duplicates = DATA(lv_dup) + ev_first_call_id = DATA(lv_first) + ev_last_call_id = DATA(lv_last) ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_dup ). + cl_abap_unit_assert=>assert_initial( act = lv_first ). + cl_abap_unit_assert=>assert_initial( act = lv_last ). + ENDMETHOD. + + METHOD rejects_bad_max. + call( EXPORTING iv_max_priority = 0 IMPORTING ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). + call( EXPORTING iv_max_priority = 6 IMPORTING ev_subrc = DATA(lv_rc6) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc6 ). + ENDMETHOD. + + METHOD rejects_bad_priority. + add_a( iv_id = 'C1' iv_prio = 9 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + call( EXPORTING iv_max_priority = 5 IMPORTING ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0121/mutation.json b/tasks_gen/eval/G0121/mutation.json new file mode 100644 index 0000000..3acb601 --- /dev/null +++ b/tasks_gen/eval/G0121/mutation.json @@ -0,0 +1,64 @@ +{ + "task": "G0121", + "mutants": [ + { + "object": "{{P}}ALERT_MERGE", + "mutant": "line 26: < -> >= (rel)", + "status": "killed", + "hidden": "2/11", + "failed_tests": [ + "COUNTS_DUPLICATES", + "FILTERS_BY_PRIORITY", + "KEEPS_A_ON_TIE", + "KEEPS_EARLIEST_CALL", + "MERGES_BOTH_TABLES", + "REJECTS_BAD_MAX", + "SORTS_BY_CALL_ID", + "SORTS_BY_PRIORITY", + "SORTS_BY_TIME" + ] + }, + { + "object": "{{P}}ALERT_MERGE", + "mutant": "line 32: 1 -> 2 (const)", + "status": "killed", + "hidden": "6/11", + "failed_tests": [ + "COUNTS_DUPLICATES", + "FILTERS_BY_PRIORITY", + "SORTS_BY_CALL_ID", + "SORTS_BY_PRIORITY", + "SORTS_BY_TIME" + ] + }, + { + "object": "{{P}}ALERT_MERGE", + "mutant": "line 32: 5 -> 6 (const)", + "status": "survived", + "hidden": "11/11", + "failed_tests": [] + }, + { + "object": "{{P}}ALERT_MERGE", + "mutant": "line 51: AND -> OR (logic)", + "status": "invalid", + "hidden": "0/0", + "failed_tests": [] + }, + { + "object": "{{P}}ALERT_MERGE", + "mutant": "line 69: - -> + (arith)", + "status": "killed", + "hidden": "8/11", + "failed_tests": [ + "COUNTS_DUPLICATES", + "FILTERS_BY_PRIORITY", + "KEEPS_EARLIEST_CALL" + ] + } + ], + "valid": 4, + "killed": 3, + "kill_rate": 0.75, + "ok": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0121/reference/alert_merge.func.abap b/tasks_gen/eval/G0121/reference/alert_merge.func.abap new file mode 100644 index 0000000..67a81e6 --- /dev/null +++ b/tasks_gen/eval/G0121/reference/alert_merge.func.abap @@ -0,0 +1,85 @@ +FUNCTION {{p}}alert_merge + IMPORTING + iv_max_priority TYPE i + EXPORTING + ev_count TYPE i + ev_duplicates TYPE i + ev_first_call_id TYPE string + ev_first_district TYPE string + ev_last_call_id TYPE string + EXCEPTIONS + invalid_priority. + + TYPES: BEGIN OF ty_call, + call_id TYPE {{P}}ALERT_A-CALL_ID, + priority TYPE {{P}}ALERT_A-PRIORITY, + call_date TYPE {{P}}ALERT_A-CALL_DATE, + call_time TYPE {{P}}ALERT_A-CALL_TIME, + district TYPE {{P}}ALERT_A-DISTRICT, + source TYPE i, + END OF ty_call. + + DATA lt_calls TYPE STANDARD TABLE OF ty_call WITH DEFAULT KEY. + DATA ls_call TYPE ty_call. + DATA lv_total TYPE i. + + IF iv_max_priority < 1 OR iv_max_priority > 5. + RAISE invalid_priority. + ENDIF. + + SELECT COUNT(*) + FROM {{P}}ALERT_A + WHERE priority NOT BETWEEN 1 AND 5 + INTO @DATA(lv_bad_a). + + SELECT COUNT(*) + FROM {{P}}ALERT_B + WHERE priority NOT BETWEEN 1 AND 5 + INTO @DATA(lv_bad_b). + + IF lv_bad_a > 0 OR lv_bad_b > 0. + RAISE invalid_priority. + ENDIF. + + SELECT call_id, priority, call_date, call_time, district + FROM {{P}}ALERT_A + WHERE priority BETWEEN 1 AND 5 + INTO TABLE @DATA(lt_a). + + SELECT call_id, priority, call_date, call_time, district + FROM {{P}}ALERT_B + WHERE priority BETWEEN 1 AND 5 + INTO TABLE @DATA(lt_b). + + LOOP AT lt_a INTO DATA(ls_a). + ls_call = CORRESPONDING #( ls_a ). + ls_call-source = 1. + APPEND ls_call TO lt_calls. + ENDLOOP. + + LOOP AT lt_b INTO DATA(ls_b). + ls_call = CORRESPONDING #( ls_b ). + ls_call-source = 2. + APPEND ls_call TO lt_calls. + ENDLOOP. + + lv_total = lines( lt_calls ). + SORT lt_calls BY call_id call_date call_time source. + DELETE ADJACENT DUPLICATES FROM lt_calls COMPARING call_id. + ev_duplicates = lv_total - lines( lt_calls ). + + DELETE lt_calls WHERE priority > iv_max_priority. + SORT lt_calls BY priority call_date call_time call_id. + ev_count = lines( lt_calls ). + + IF lt_calls IS NOT INITIAL. + READ TABLE lt_calls INTO ls_call INDEX 1. + ev_first_call_id = ls_call-call_id. + ev_first_district = ls_call-district. + READ TABLE lt_calls INTO ls_call INDEX ev_count. + ev_last_call_id = ls_call-call_id. + ELSE. + CLEAR: ev_first_call_id, ev_first_district, ev_last_call_id. + ENDIF. + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0121/reference/roast_sum.func.abap b/tasks_gen/eval/G0121/reference/roast_sum.func.abap deleted file mode 100644 index 8ba4d87..0000000 --- a/tasks_gen/eval/G0121/reference/roast_sum.func.abap +++ /dev/null @@ -1,45 +0,0 @@ -FUNCTION {{p}}roast_sum - IMPORTING - it_orders TYPE STANDARD TABLE OF {{p}}roasts - EXPORTING - et_totals TYPE STANDARD TABLE OF {{p}}blends - ev_grand_total TYPE decfloat34. - - TYPES: BEGIN OF ty_sum, - blend TYPE {{p}}blends-blend, - total_kg TYPE {{p}}blends-total_kg, - END OF ty_sum. - - DATA lt_sum TYPE HASHED TABLE OF ty_sum WITH UNIQUE KEY blend. - DATA ls_ord TYPE {{p}}roasts. - DATA ls_sum TYPE ty_sum. - DATA ls_tot TYPE {{p}}blends. - - CLEAR: et_totals, ev_grand_total. - - LOOP AT it_orders INTO ls_ord. - IF ls_ord-quantity_kg <= 0. - CONTINUE. - ENDIF. - - READ TABLE lt_sum INTO ls_sum WITH TABLE KEY blend = ls_ord-blend. - IF sy-subrc = 0. - ls_sum-total_kg = ls_sum-total_kg + ls_ord-quantity_kg. - MODIFY TABLE lt_sum FROM ls_sum. - ELSE. - ls_sum-blend = ls_ord-blend. - ls_sum-total_kg = ls_ord-quantity_kg. - INSERT ls_sum INTO TABLE lt_sum. - ENDIF. - ENDLOOP. - - LOOP AT lt_sum INTO ls_sum. - ls_tot-blend = ls_sum-blend. - ls_tot-total_kg = ls_sum-total_kg. - ev_grand_total = ev_grand_total + ls_sum-total_kg. - APPEND ls_tot TO et_totals. - ENDLOOP. - - SORT et_totals BY total_kg DESCENDING blend ASCENDING. - -ENDFUNCTION. diff --git a/tasks_gen/eval/G0121/reference/t14_test.clas.abap b/tasks_gen/eval/G0121/reference/t14_test.clas.abap deleted file mode 100644 index 9245ec7..0000000 --- a/tasks_gen/eval/G0121/reference/t14_test.clas.abap +++ /dev/null @@ -1,109 +0,0 @@ -CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - - PRIVATE SECTION. - TYPES ty_orders TYPE STANDARD TABLE OF {{p}}roasts. - TYPES ty_totals TYPE STANDARD TABLE OF {{p}}blends. - - METHODS run - IMPORTING it_orders TYPE ty_orders - EXPORTING et_totals TYPE ty_totals - ev_grand_total TYPE decfloat34 - ev_subrc TYPE sysubrc. - - METHODS sums_per_blend FOR TESTING. - METHODS ignores_non_positive FOR TESTING. - METHODS sorted_by_total FOR TESTING. - METHODS tie_break FOR TESTING. - METHODS empty_input FOR TESTING. -ENDCLASS. - - -CLASS {{p}}t14_test IMPLEMENTATION. - - METHOD run. - CLEAR: et_totals, ev_grand_total. - CALL FUNCTION '{{P}}ROAST_SUM' - EXPORTING - it_orders = it_orders - IMPORTING - et_totals = et_totals - ev_grand_total = ev_grand_total - EXCEPTIONS - OTHERS = 1. - ev_subrc = sy-subrc. - ENDMETHOD. - - METHOD sums_per_blend. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '10.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'PILS' quantity_kg = '5.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ). - - DATA ls_tot TYPE {{p}}blends. - READ TABLE lt_totals INTO ls_tot INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'PILS' act = ls_tot-blend ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 15 ) act = CONV decfloat34( ls_tot-total_kg ) ). - ENDMETHOD. - - METHOD ignores_non_positive. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '0.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'WEIZ' quantity_kg = '-4.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_totals ) ). - ENDMETHOD. - - METHOD sorted_by_total. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'ARAB' quantity_kg = '5.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'ROBU' quantity_kg = '30.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - DATA ls_tot TYPE {{p}}blends. - READ TABLE lt_totals INTO ls_tot INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'ROBU' act = ls_tot-blend ). - ENDMETHOD. - - METHOD tie_break. - DATA lt_orders TYPE ty_orders. - APPEND VALUE #( order_id = '0000000001' blend = 'ROBU' quantity_kg = '6.000' ) TO lt_orders. - APPEND VALUE #( order_id = '0000000002' blend = 'ARAB' quantity_kg = '6.000' ) TO lt_orders. - - DATA lt_totals TYPE ty_totals. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - DATA ls_tot TYPE {{p}}blends. - READ TABLE lt_totals INTO ls_tot INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'ARAB' act = ls_tot-blend ). - ENDMETHOD. - - METHOD empty_input. - DATA lt_orders TYPE ty_orders. - DATA lt_totals TYPE ty_totals. - DATA lv_grand TYPE decfloat34 VALUE 99. - run( EXPORTING it_orders = lt_orders - IMPORTING et_totals = lt_totals ev_grand_total = lv_grand ev_subrc = DATA(lv_subrc) ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_totals ) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_grand ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0121/reference/t41_test.clas.abap b/tasks_gen/eval/G0121/reference/t41_test.clas.abap new file mode 100644 index 0000000..842b012 --- /dev/null +++ b/tasks_gen/eval/G0121/reference/t41_test.clas.abap @@ -0,0 +1,134 @@ +CLASS {{p}}t41_test DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS setup. + METHODS call + IMPORTING + iv_max_priority TYPE i + EXPORTING + ev_count TYPE i + ev_duplicates TYPE i + ev_first_call_id TYPE string + ev_last_call_id TYPE string + ev_subrc TYPE sysubrc. + METHODS add_a + IMPORTING + iv_id TYPE {{P}}ALERT_A-CALL_ID + iv_prio TYPE {{P}}ALERT_A-PRIORITY + iv_date TYPE {{P}}ALERT_A-CALL_DATE + iv_time TYPE {{P}}ALERT_A-CALL_TIME + iv_district TYPE {{P}}ALERT_A-DISTRICT. + METHODS add_b + IMPORTING + iv_id TYPE {{P}}ALERT_B-CALL_ID + iv_prio TYPE {{P}}ALERT_B-PRIORITY + iv_date TYPE {{P}}ALERT_B-CALL_DATE + iv_time TYPE {{P}}ALERT_B-CALL_TIME + iv_district TYPE {{P}}ALERT_B-DISTRICT. + METHODS merges_and_sorts FOR TESTING. + METHODS keeps_earliest FOR TESTING. + METHODS counts_duplicates FOR TESTING. + METHODS filters_by_priority FOR TESTING. + METHODS empty_tables FOR TESTING. + METHODS rejects_bad_priority FOR TESTING. +ENDCLASS. + + +CLASS {{p}}t41_test IMPLEMENTATION. + METHOD setup. + DELETE FROM {{P}}ALERT_A. + DELETE FROM {{P}}ALERT_B. + ENDMETHOD. + + METHOD call. + CALL FUNCTION '{{P}}ALERT_MERGE' + EXPORTING + iv_max_priority = iv_max_priority + IMPORTING + ev_count = ev_count + ev_duplicates = ev_duplicates + ev_first_call_id = ev_first_call_id + ev_last_call_id = ev_last_call_id + EXCEPTIONS + invalid_priority = 1 + OTHERS = 2. + ev_subrc = sy-subrc. + ENDMETHOD. + + METHOD add_a. + DATA ls_call TYPE {{P}}ALERT_A. + ls_call-call_id = iv_id. + ls_call-priority = iv_prio. + ls_call-call_date = iv_date. + ls_call-call_time = iv_time. + ls_call-district = iv_district. + MODIFY {{P}}ALERT_A FROM @ls_call. + ENDMETHOD. + + METHOD add_b. + DATA ls_call TYPE {{P}}ALERT_B. + ls_call-call_id = iv_id. + ls_call-priority = iv_prio. + ls_call-call_date = iv_date. + ls_call-call_time = iv_time. + ls_call-district = iv_district. + MODIFY {{P}}ALERT_B FROM @ls_call. + ENDMETHOD. + + METHOD merges_and_sorts. + add_a( iv_id = 'C1' iv_prio = 3 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + add_b( iv_id = 'C2' iv_prio = 1 iv_date = '20240102' iv_time = '080000' iv_district = 'SUED' ). + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_count = DATA(lv_count) + ev_first_call_id = DATA(lv_first) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 'C2' act = lv_first ). + ENDMETHOD. + + METHOD keeps_earliest. + add_a( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '100000' iv_district = 'NORD' ). + add_b( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '090000' iv_district = 'SUED' ). + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_count = DATA(lv_count) + ev_first_call_id = DATA(lv_first) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 'C1' act = lv_first ). + ENDMETHOD. + + METHOD counts_duplicates. + add_a( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + add_b( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '080000' iv_district = 'SUED' ). + add_b( iv_id = 'C2' iv_prio = 2 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_count = DATA(lv_count) + ev_duplicates = DATA(lv_dup) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_dup ). + ENDMETHOD. + + METHOD filters_by_priority. + add_a( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + add_a( iv_id = 'C2' iv_prio = 4 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + call( EXPORTING iv_max_priority = 2 + IMPORTING ev_count = DATA(lv_count) + ev_last_call_id = DATA(lv_last) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 'C1' act = lv_last ). + ENDMETHOD. + + METHOD empty_tables. + call( EXPORTING iv_max_priority = 5 + IMPORTING ev_count = DATA(lv_count) + ev_duplicates = DATA(lv_dup) + ev_first_call_id = DATA(lv_first) ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_count ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_dup ). + cl_abap_unit_assert=>assert_initial( act = lv_first ). + ENDMETHOD. + + METHOD rejects_bad_priority. + add_a( iv_id = 'C1' iv_prio = 7 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ). + call( EXPORTING iv_max_priority = 5 IMPORTING ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0121/seed/alert_a.tabl.abap b/tasks_gen/eval/G0121/seed/alert_a.tabl.abap new file mode 100644 index 0000000..43542a1 --- /dev/null +++ b/tasks_gen/eval/G0121/seed/alert_a.tabl.abap @@ -0,0 +1,11 @@ +@EndUserText.label: 'Emergency calls of centre A' +@AbapCatalog.enhancement.category: #NOT_EXTENSIBLE +@AbapCatalog.tableCategory: #TRANSPARENT +@AbapCatalog.deliveryClass: #A +define table {{p}}alert_a { + key call_id : abap.char(10) not null; + priority : abap.int1 not null; + call_date : abap.dats not null; + call_time : abap.tims not null; + district : abap.char(4) not null; +} diff --git a/tasks_gen/eval/G0121/seed/alert_b.tabl.abap b/tasks_gen/eval/G0121/seed/alert_b.tabl.abap new file mode 100644 index 0000000..27c5e70 --- /dev/null +++ b/tasks_gen/eval/G0121/seed/alert_b.tabl.abap @@ -0,0 +1,11 @@ +@EndUserText.label: 'Emergency calls of centre B' +@AbapCatalog.enhancement.category: #NOT_EXTENSIBLE +@AbapCatalog.tableCategory: #TRANSPARENT +@AbapCatalog.deliveryClass: #A +define table {{p}}alert_b { + key call_id : abap.char(10) not null; + priority : abap.int1 not null; + call_date : abap.dats not null; + call_time : abap.tims not null; + district : abap.char(4) not null; +} diff --git a/tasks_gen/eval/G0121/seed/blends.tabl.abap b/tasks_gen/eval/G0121/seed/blends.tabl.abap deleted file mode 100644 index 21b8f58..0000000 --- a/tasks_gen/eval/G0121/seed/blends.tabl.abap +++ /dev/null @@ -1,7 +0,0 @@ -@EndUserText.label : 'Roast total per blend' -@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE -define table {{p}}blends { - key client : abap.clnt not null; - key blend : abap.char(4) not null; - total_kg : abap.dec(15,3); -} diff --git a/tasks_gen/eval/G0121/seed/roast_seed.clas.abap b/tasks_gen/eval/G0121/seed/roast_seed.clas.abap deleted file mode 100644 index ff0ed7b..0000000 --- a/tasks_gen/eval/G0121/seed/roast_seed.clas.abap +++ /dev/null @@ -1,28 +0,0 @@ -CLASS {{p}}roast_seed DEFINITION - PUBLIC - FINAL - CREATE PUBLIC. - - PUBLIC SECTION. - INTERFACES if_oo_adt_classrun. -ENDCLASS. - - -CLASS {{p}}roast_seed IMPLEMENTATION. - METHOD if_oo_adt_classrun~main. - DATA lt_lines TYPE STANDARD TABLE OF {{p}}roasts. - lt_lines = VALUE #( - ( client = sy-mandt order_id = '0000000001' blend = 'PILS' quantity_kg = '120.500' ) - ( client = sy-mandt order_id = '0000000002' blend = 'WEIZ' quantity_kg = '80.000' ) - ( client = sy-mandt order_id = '0000000003' blend = 'PILS' quantity_kg = '60.250' ) - ( client = sy-mandt order_id = '0000000004' blend = 'KOLS' quantity_kg = '45.000' ) - ( client = sy-mandt order_id = '0000000005' blend = 'PILS' quantity_kg = '0.000' ) - ( client = sy-mandt order_id = '0000000006' blend = 'WEIZ' quantity_kg = '20.000' ) - ). - - DELETE FROM {{p}}roasts. - INSERT {{p}}roasts FROM TABLE @lt_lines. - - out->write( |{ sy-dbcnt } roast lines inserted| ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0121/seed/roasts.tabl.abap b/tasks_gen/eval/G0121/seed/roasts.tabl.abap deleted file mode 100644 index 10b1205..0000000 --- a/tasks_gen/eval/G0121/seed/roasts.tabl.abap +++ /dev/null @@ -1,8 +0,0 @@ -@EndUserText.label : 'Roast order line' -@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE -define table {{p}}roasts { - key client : abap.clnt not null; - key order_id : abap.numc(10) not null; - blend : abap.char(4); - quantity_kg : abap.dec(15,3); -} diff --git a/tasks_gen/eval/G0121/spec.md b/tasks_gen/eval/G0121/spec.md index 21b2879..abe7ef0 100644 --- a/tasks_gen/eval/G0121/spec.md +++ b/tasks_gen/eval/G0121/spec.md @@ -1,52 +1,71 @@ # 1. Goal -A coffee roastery plans its daily production. A planning program calls one -function module for each production day. The function module groups the roast -order lines of the day by coffee blend and returns the total green coffee -quantity of each blend. The planning program shows the blend with the largest -quantity first. +A regional emergency control centre collects the open emergency calls of two +control centres. The dispatch program calls one function module for each +dispatch run. The function module must merge the calls of both control centres +and must return the figures of the dispatch list. # 2. Open questions None. # 3. Context -- Function group {{P}}FG_ROAST exists in package $TMP. -- Table {{P}}ROASTS exists in package $TMP. It stores the roast order lines of - a production day. -- Table {{P}}BLENDS exists in package $TMP. It is the line type of the result +- Function group {{P}}FG_ALERT exists in package $TMP. +- The database table {{P}}ALERT_A exists in package $TMP. It contains the open + emergency calls of control centre A. +- The database table {{P}}ALERT_B exists in package $TMP. It contains the open + emergency calls of control centre B. +- Both tables have the same fields: + - CALL_ID: the call number, 10 characters. + - PRIORITY: the urgency. 1 is the highest urgency, 5 is the lowest urgency. + - CALL_DATE: the date on which the call was reported. + - CALL_TIME: the time at which the call was reported. + - DISTRICT: the district of the caller, 4 characters. +- CALL_ID is the key of each table. A call ID occurs at most one time in each table. -- The class {{P}}ROAST_SEED fills {{P}}ROASTS with sample data. Run it to get - test data. # 4. Contract -- Create the function module {{P}}ROAST_SUM in function group {{P}}FG_ROAST. -- Interface of {{P}}ROAST_SUM: - - IMPORTING it_orders TYPE STANDARD TABLE OF {{P}}ROASTS - - EXPORTING et_totals TYPE STANDARD TABLE OF {{P}}BLENDS - - EXPORTING ev_grand_total TYPE decfloat34 -- The function module has no exceptions. +- Create the function module {{P}}ALERT_MERGE in function group {{P}}FG_ALERT. +- The function module has this interface: + - Importing parameter IV_MAX_PRIORITY, type i. + - Exporting parameter EV_COUNT, type i. + - Exporting parameter EV_DUPLICATES, type i. + - Exporting parameter EV_FIRST_CALL_ID, type string. + - Exporting parameter EV_FIRST_DISTRICT, type string. + - Exporting parameter EV_LAST_CALL_ID, type string. + - Exception INVALID_PRIORITY. # 5. Business rules -1. A line of it_orders is a production line if its quantity is greater than 0. - A line with a quantity of 0 or less is not a production line. -2. et_totals has exactly one line for each blend that has at least one - production line in it_orders. -3. The total quantity of a blend is the sum of the quantities of all its - production lines. -4. Sort et_totals by total quantity. The largest total quantity comes first. -5. If two blends have the same total quantity, the blend that is smaller in the - character order comes first. -6. ev_grand_total is the sum of the total quantities of all lines of et_totals. -7. If it_orders is empty, or if it_orders has no production line, et_totals is - empty and ev_grand_total is 0. +1. The function module reads the open calls of both control centres from the + tables {{P}}ALERT_A and {{P}}ALERT_B. +2. The dispatch list contains each call ID at most one time. +3. If one call ID is in both tables, the dispatch list contains the call with + the earlier report time. The report time is CALL_DATE first and CALL_TIME + second. +4. If both calls with the same call ID have the same report time, the dispatch + list contains the call from {{P}}ALERT_A. +5. The dispatch list contains only calls with a PRIORITY that is at most + IV_MAX_PRIORITY. +6. The dispatch list is sorted by PRIORITY in ascending order. Lines with the + same PRIORITY are sorted by CALL_DATE in ascending order, then by CALL_TIME + in ascending order, then by CALL_ID in ascending order. +7. EV_COUNT is the number of lines in the dispatch list. +8. EV_DUPLICATES is the number of call IDs that are in both tables. Rule 5 + does not change EV_DUPLICATES. +9. EV_FIRST_CALL_ID and EV_FIRST_DISTRICT are the call ID and the district of + the first line of the dispatch list. EV_LAST_CALL_ID is the call ID of the + last line of the dispatch list. If the dispatch list is empty, these three + parameters are empty strings. +10. If IV_MAX_PRIORITY is smaller than 1 or larger than 5, raise the exception + INVALID_PRIORITY. +11. If a call in {{P}}ALERT_A or in {{P}}ALERT_B has a PRIORITY that is smaller + than 1 or larger than 5, raise the exception INVALID_PRIORITY. # 6. Constraints - Release target: 7.58. -- Package: $TMP. Do not use transports. -- Coding standard: Clean ABAP. Keep the function module short. Choose the - internal table kind and the access path that fit the task. -- Out of scope: do not change {{P}}ROASTS, {{P}}BLENDS, {{P}}ROAST_SEED. +- Apply the coding standards of Clean ABAP. +- Out of scope: do not change the tables {{P}}ALERT_A and {{P}}ALERT_B and the + function group {{P}}FG_ALERT. # 7. Acceptance -- The function module {{P}}ROAST_SUM is active and has no syntax error. +- The function module is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests for the function module in a global test class. diff --git a/tasks_gen/eval/G0121/task.json b/tasks_gen/eval/G0121/task.json index 915abed..5d16076 100644 --- a/tasks_gen/eval/G0121/task.json +++ b/tasks_gen/eval/G0121/task.json @@ -10,83 +10,85 @@ "max_activations": 15 }, "seed": [ + { + "type": "TABL", + "name": "{{P}}ALERT_A", + "file": "seed/alert_a.tabl.abap", + "description": "Emergency calls of control centre A" + }, + { + "type": "TABL", + "name": "{{P}}ALERT_B", + "file": "seed/alert_b.tabl.abap", + "description": "Emergency calls of control centre B" + }, { "type": "FUGR", - "name": "{{P}}FG_ROAST", - "description": "Roast production" - }, - { - "type": "TABL", - "name": "{{P}}ROASTS", - "file": "seed/roasts.tabl.abap", - "description": "Roast order lines of a production day" - }, - { - "type": "TABL", - "name": "{{P}}BLENDS", - "file": "seed/blends.tabl.abap", - "description": "Line type of the result table" - }, - { - "type": "CLAS", - "name": "{{P}}ROAST_SEED", - "file": "seed/roast_seed.clas.abap", - "description": "Sample data for {{P}}ROASTS", - "run": true + "name": "{{P}}FG_ALERT", + "description": "Emergency alert processing" } ], "contract": [ { "type": "FUNC", - "name": "{{P}}ROAST_SUM", - "functionGroup": "{{P}}FG_ROAST", + "name": "{{P}}ALERT_MERGE", + "functionGroup": "{{P}}FG_ALERT", "params": [ { - "name": "it_orders", - "type": "STANDARD TABLE OF {{P}}ROASTS" + "name": "iv_max_priority", + "type": "i" }, { - "name": "et_totals", - "type": "STANDARD TABLE OF {{P}}BLENDS" + "name": "ev_count", + "type": "i" }, { - "name": "ev_grand_total", - "type": "decfloat34" + "name": "ev_duplicates", + "type": "i" + }, + { + "name": "ev_first_call_id", + "type": "string" + }, + { + "name": "ev_first_district", + "type": "string" + }, + { + "name": "ev_last_call_id", + "type": "string" } ] } ], "out_of_scope": [ - "{{P}}ROASTS", - "{{P}}BLENDS", - "{{P}}ROAST_SEED" + "{{P}}ALERT_A", + "{{P}}ALERT_B" ], "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}T14_HIDDEN", - "file": "hidden/t14_hidden.clas.abap", - "description": "T14 hidden tests" + "name": "{{P}}T41_HIDDEN", + "file": "hidden/t41_hidden.clas.abap", + "description": "T41 hidden tests" } ], "reference": [ { "type": "FUNC", - "name": "{{P}}ROAST_SUM", - "functionGroup": "{{P}}FG_ROAST", - "file": "reference/roast_sum.func.abap", - "description": "Roast sum module" + "name": "{{P}}ALERT_MERGE", + "functionGroup": "{{P}}FG_ALERT", + "file": "reference/alert_merge.func.abap", + "description": "Alert merge module" }, { "type": "CLAS", - "name": "{{P}}T14_TEST", - "file": "reference/t14_test.clas.abap", - "description": "T14 own tests" + "name": "{{P}}T41_TEST", + "file": "reference/t41_test.clas.abap", + "description": "T41 own tests" } ], "craft_checks": [ - "method_length", - "table_kind", - "access_path" + "method_length" ] } \ No newline at end of file diff --git a/tasks_gen/eval/G0122/generation.json b/tasks_gen/eval/G0122/generation.json new file mode 100644 index 0000000..8350df6 --- /dev/null +++ b/tasks_gen/eval/G0122/generation.json @@ -0,0 +1,36 @@ +{ + "id": "G0122", + "pool": "eval", + "object_type": "FUNC", + "category": "C", + "attempts": [ + { + "stage": "bundle", + "errors": [ + "seed/t_path.tabl.abap: a table needs the annotation @AbapCatalog.tableCategory (for example #TRANSPARENT, #A)", + "seed/t_path.tabl.abap: a table needs the annotation @AbapCatalog.deliveryClass (for example #TRANSPARENT, #A)", + "seed/t_fee.tabl.abap: a table needs the annotation @AbapCatalog.tableCategory (for example #TRANSPARENT, #A)", + "seed/t_fee.tabl.abap: a table needs the annotation @AbapCatalog.deliveryClass (for example #TRANSPARENT, #A)" + ], + "by_check": { + "static": 4 + } + }, + { + "stage": "validate", + "oracle": null, + "null": null + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + } + ], + "accepted": false +} \ No newline at end of file diff --git a/tasks_gen/eval/G0122/hidden/t31_hidden.clas.abap b/tasks_gen/eval/G0122/hidden/t31_hidden.clas.abap deleted file mode 100644 index c21e07f..0000000 --- a/tasks_gen/eval/G0122/hidden/t31_hidden.clas.abap +++ /dev/null @@ -1,302 +0,0 @@ -CLASS {{p}}t31_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - - PRIVATE SECTION. - TYPES ty_stations TYPE STANDARD TABLE OF {{p}}station. - TYPES ty_moves TYPE STANDARD TABLE OF {{p}}move. - TYPES ty_id TYPE {{p}}station-station_id. - TYPES ty_name TYPE {{p}}station-station_name. - - METHODS given - IMPORTING it_stations TYPE ty_stations - it_moves TYPE ty_moves. - - METHODS rebalance - IMPORTING iv_dry_run TYPE abap_bool DEFAULT abap_false - EXPORTING ev_applied TYPE i - ev_rejected TYPE i. - - METHODS bikes_of - IMPORTING iv_id TYPE ty_id - RETURNING VALUE(rv_bikes) TYPE i. - - METHODS name_of - IMPORTING iv_id TYPE ty_id - RETURNING VALUE(rv_name) TYPE ty_name. - - METHODS applies_one_move FOR TESTING. - METHODS applies_in_move_order FOR TESTING. - METHODS rejects_unknown_station FOR TESTING. - METHODS rejects_insufficient_bikes FOR TESTING. - METHODS rejects_full_target FOR TESTING. - METHODS rejects_non_positive_qty FOR TESTING. - METHODS rejects_same_station FOR TESTING. - METHODS counts_rejections FOR TESTING. - METHODS keeps_untouched_stations FOR TESTING. - METHODS dry_run_keeps_state FOR TESTING. -ENDCLASS. - - -CLASS {{p}}t31_hidden IMPLEMENTATION. - - METHOD given. - DATA(lt_stations) = it_stations. - DATA(lt_moves) = it_moves. - - LOOP AT lt_stations ASSIGNING FIELD-SYMBOL(). - -client = sy-mandt. - ENDLOOP. - - LOOP AT lt_moves ASSIGNING FIELD-SYMBOL(). - -client = sy-mandt. - ENDLOOP. - - DELETE FROM {{p}}station. - DELETE FROM {{p}}move. - INSERT {{p}}station FROM TABLE @lt_stations. - INSERT {{p}}move FROM TABLE @lt_moves. - ENDMETHOD. - - METHOD rebalance. - CALL FUNCTION '{{P}}BIKE_REBALANCE' - EXPORTING - iv_dry_run = iv_dry_run - IMPORTING - ev_applied = ev_applied - ev_rejected = ev_rejected - EXCEPTIONS - OTHERS = 1. - cl_abap_unit_assert=>assert_subrc( exp = 0 ). - ENDMETHOD. - - METHOD bikes_of. - SELECT SINGLE bikes FROM {{p}}station - INTO @rv_bikes - WHERE station_id = @iv_id. - ENDMETHOD. - - METHOD name_of. - SELECT SINGLE station_name FROM {{p}}station - INTO @rv_name - WHERE station_id = @iv_id. - ENDMETHOD. - - METHOD applies_one_move. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 6 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 10 bikes = 1 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 4 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 2 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 5 ). - ENDMETHOD. - - METHOD applies_in_move_order. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 5 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 10 bikes = 0 ) - ( station_id = 'S003' station_name = 'Gamma' capacity = 10 bikes = 0 ) ). - lt_moves = VALUE #( - ( move_no = 2 source_id = 'S001' target_id = 'S002' quantity = 5 ) - ( move_no = 1 source_id = 'S002' target_id = 'S003' quantity = 5 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 5 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S003' ) exp = 0 ). - ENDMETHOD. - - METHOD rejects_unknown_station. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 6 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S009' target_id = 'S001' quantity = 2 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 6 ). - ENDMETHOD. - - METHOD rejects_insufficient_bikes. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 2 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 10 bikes = 0 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 5 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 2 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 0 ). - ENDMETHOD. - - METHOD rejects_full_target. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 5 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 4 bikes = 4 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 1 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 5 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 4 ). - ENDMETHOD. - - METHOD rejects_non_positive_qty. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 5 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 10 bikes = 0 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 0 ) - ( move_no = 2 source_id = 'S001' target_id = 'S002' quantity = -3 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 2 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 5 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 0 ). - ENDMETHOD. - - METHOD rejects_same_station. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 5 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S001' quantity = 2 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 5 ). - ENDMETHOD. - - METHOD counts_rejections. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 5 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 10 bikes = 0 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 2 ) - ( move_no = 2 source_id = 'S001' target_id = 'S999' quantity = 1 ) - ( move_no = 3 source_id = 'S001' target_id = 'S002' quantity = 0 ) - ( move_no = 4 source_id = 'S001' target_id = 'S002' quantity = 100 ) - ( move_no = 5 source_id = 'S002' target_id = 'S001' quantity = 1 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 2 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 3 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 4 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 1 ). - ENDMETHOD. - - METHOD keeps_untouched_stations. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 4 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 10 bikes = 4 ) - ( station_id = 'S003' station_name = 'Gamma' capacity = 12 bikes = 7 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 1 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 3 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 5 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S003' ) exp = 7 ). - cl_abap_unit_assert=>assert_equals( act = name_of( 'S003' ) exp = CONV ty_name( 'Gamma' ) ). - ENDMETHOD. - - METHOD dry_run_keeps_state. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 5 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 10 bikes = 0 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 3 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( EXPORTING iv_dry_run = abap_true - IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 5 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 0 ). - ENDMETHOD. - -ENDCLASS. diff --git a/tasks_gen/eval/G0122/hidden/track_hidden.clas.abap b/tasks_gen/eval/G0122/hidden/track_hidden.clas.abap new file mode 100644 index 0000000..a9d7286 --- /dev/null +++ b/tasks_gen/eval/G0122/hidden/track_hidden.clas.abap @@ -0,0 +1,129 @@ +CLASS {{p}}track_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + + PRIVATE SECTION. + TYPES ty_paths TYPE {{P}}TRACK_TYPES=>tt_path. + TYPES ty_fees TYPE {{P}}TRACK_TYPES=>tt_fee. + TYPES ty_km TYPE {{P}}TRACK_TYPES=>ty_km. + TYPES ty_money TYPE {{P}}TRACK_TYPES=>ty_money. + + METHODS call_fm + IMPORTING it_paths TYPE ty_paths + EXPORTING et_fees TYPE ty_fees + ev_subrc TYPE sysubrc. + + METHODS one_path_one_row FOR TESTING. + METHODS groups_and_sorts FOR TESTING. + METHODS night_surcharge FOR TESTING. + METHODS minimum_fee FOR TESTING. + METHODS rounds_up FOR TESTING. + METHODS invalid_distance FOR TESTING. + METHODS invalid_category FOR TESTING. + METHODS empty_input FOR TESTING. +ENDCLASS. + + +CLASS {{p}}track_hidden IMPLEMENTATION. + + METHOD call_fm. + CALL FUNCTION '{{P}}TRACK_FEE' + EXPORTING + it_paths = it_paths + IMPORTING + et_fees = et_fees + EXCEPTIONS + invalid_distance = 1 + invalid_category = 2 + OTHERS = 3. + ev_subrc = sy-subrc. + ENDMETHOD. + + METHOD one_path_one_row. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'IC' distance_km = '100.00' night_flag = '' ) ). + call_fm( EXPORTING it_paths = lt_paths + IMPORTING et_fees = DATA(lt_fees) ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_fees ) ). + DATA(ls_fee) = lt_fees[ 1 ]. + cl_abap_unit_assert=>assert_equals( exp = 'IC' act = ls_fee-train_cat ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_fee-path_count ). + cl_abap_unit_assert=>assert_equals( exp = CONV ty_km( '100.00' ) act = ls_fee-total_km ). + cl_abap_unit_assert=>assert_equals( exp = CONV ty_money( '120.00' ) act = ls_fee-total_fee ). + ENDMETHOD. + + METHOD groups_and_sorts. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'IC' distance_km = '100.00' night_flag = '' ) + ( path_id = '00000002' train_cat = 'FR' distance_km = '100.00' night_flag = '' ) + ( path_id = '00000003' train_cat = 'IC' distance_km = '50.00' night_flag = '' ) ). + call_fm( EXPORTING it_paths = lt_paths + IMPORTING et_fees = DATA(lt_fees) ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_fees ) ). + DATA(ls_first) = lt_fees[ 1 ]. + DATA(ls_last) = lt_fees[ 2 ]. + cl_abap_unit_assert=>assert_equals( exp = 'FR' act = ls_first-train_cat ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_first-path_count ). + cl_abap_unit_assert=>assert_equals( exp = CONV ty_money( '60.00' ) act = ls_first-total_fee ). + cl_abap_unit_assert=>assert_equals( exp = 'IC' act = ls_last-train_cat ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_last-path_count ). + cl_abap_unit_assert=>assert_equals( exp = CONV ty_km( '150.00' ) act = ls_last-total_km ). + cl_abap_unit_assert=>assert_equals( exp = CONV ty_money( '180.00' ) act = ls_last-total_fee ). + ENDMETHOD. + + METHOD night_surcharge. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'RG' distance_km = '100.00' night_flag = 'X' ) ). + call_fm( EXPORTING it_paths = lt_paths + IMPORTING et_fees = DATA(lt_fees) ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ). + DATA(ls_fee) = lt_fees[ 1 ]. + cl_abap_unit_assert=>assert_equals( exp = CONV ty_money( '108.00' ) act = ls_fee-total_fee ). + ENDMETHOD. + + METHOD minimum_fee. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'FR' distance_km = '2.00' night_flag = '' ) ). + call_fm( EXPORTING it_paths = lt_paths + IMPORTING et_fees = DATA(lt_fees) ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ). + DATA(ls_fee) = lt_fees[ 1 ]. + cl_abap_unit_assert=>assert_equals( exp = CONV ty_money( '5.00' ) act = ls_fee-total_fee ). + ENDMETHOD. + + METHOD rounds_up. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'FR' distance_km = '10.01' night_flag = '' ) ). + call_fm( EXPORTING it_paths = lt_paths + IMPORTING et_fees = DATA(lt_fees) ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ). + DATA(ls_fee) = lt_fees[ 1 ]. + cl_abap_unit_assert=>assert_equals( exp = CONV ty_money( '6.01' ) act = ls_fee-total_fee ). + ENDMETHOD. + + METHOD invalid_distance. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'IC' distance_km = '0.00' night_flag = '' ) ). + call_fm( EXPORTING it_paths = lt_paths + IMPORTING et_fees = DATA(lt_fees) ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). + ENDMETHOD. + + METHOD invalid_category. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'XX' distance_km = '10.00' night_flag = '' ) ). + call_fm( EXPORTING it_paths = lt_paths + IMPORTING et_fees = DATA(lt_fees) ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc ). + ENDMETHOD. + + METHOD empty_input. + DATA lt_paths TYPE ty_paths. + call_fm( EXPORTING it_paths = lt_paths + IMPORTING et_fees = DATA(lt_fees) ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ). + cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_fees ) ). + ENDMETHOD. + +ENDCLASS. diff --git a/tasks_gen/eval/G0122/reference/bike_rebalance.func.abap b/tasks_gen/eval/G0122/reference/bike_rebalance.func.abap deleted file mode 100644 index 90a649b..0000000 --- a/tasks_gen/eval/G0122/reference/bike_rebalance.func.abap +++ /dev/null @@ -1,65 +0,0 @@ -FUNCTION {{p}}bike_rebalance - IMPORTING - iv_dry_run TYPE abap_bool - EXPORTING - ev_applied TYPE i - ev_rejected TYPE i. - - DATA lt_state TYPE STANDARD TABLE OF {{p}}station. - DATA lt_moves TYPE STANDARD TABLE OF {{p}}move. - - SELECT station_id, station_name, capacity, bikes - FROM {{p}}station - INTO TABLE @lt_state. - - SELECT move_no, source_id, target_id, quantity - FROM {{p}}move - INTO TABLE @lt_moves. - - SORT lt_state BY station_id. - SORT lt_moves BY move_no. - - ev_applied = 0. - ev_rejected = 0. - - LOOP AT lt_moves INTO DATA(ls_move). - IF ls_move-quantity <= 0 - OR ls_move-source_id = ls_move-target_id. - ev_rejected = ev_rejected + 1. - CONTINUE. - ENDIF. - - READ TABLE lt_state ASSIGNING FIELD-SYMBOL() - WITH KEY station_id = ls_move-source_id BINARY SEARCH. - IF sy-subrc <> 0. - ev_rejected = ev_rejected + 1. - CONTINUE. - ENDIF. - - READ TABLE lt_state ASSIGNING FIELD-SYMBOL() - WITH KEY station_id = ls_move-target_id BINARY SEARCH. - IF sy-subrc <> 0. - ev_rejected = ev_rejected + 1. - CONTINUE. - ENDIF. - - IF -bikes < ls_move-quantity - OR -capacity - -bikes < ls_move-quantity. - ev_rejected = ev_rejected + 1. - CONTINUE. - ENDIF. - - -bikes = -bikes - ls_move-quantity. - -bikes = -bikes + ls_move-quantity. - ev_applied = ev_applied + 1. - ENDLOOP. - - IF iv_dry_run = abap_false. - LOOP AT lt_state INTO DATA(ls_state). - UPDATE {{p}}station - SET bikes = @ls_state-bikes - WHERE station_id = @ls_state-station_id. - ENDLOOP. - ENDIF. - -ENDFUNCTION. diff --git a/tasks_gen/eval/G0122/reference/t31_test.clas.abap b/tasks_gen/eval/G0122/reference/t31_test.clas.abap deleted file mode 100644 index df2d106..0000000 --- a/tasks_gen/eval/G0122/reference/t31_test.clas.abap +++ /dev/null @@ -1,130 +0,0 @@ -CLASS {{p}}t31_test DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - - PRIVATE SECTION. - TYPES ty_stations TYPE STANDARD TABLE OF {{p}}station. - TYPES ty_moves TYPE STANDARD TABLE OF {{p}}move. - TYPES ty_id TYPE {{p}}station-station_id. - - METHODS given - IMPORTING it_stations TYPE ty_stations - it_moves TYPE ty_moves. - - METHODS rebalance - IMPORTING iv_dry_run TYPE abap_bool DEFAULT abap_false - EXPORTING ev_applied TYPE i - ev_rejected TYPE i. - - METHODS bikes_of - IMPORTING iv_id TYPE ty_id - RETURNING VALUE(rv_bikes) TYPE i. - - METHODS applies_move FOR TESTING. - METHODS rejects_move FOR TESTING. - METHODS dry_run FOR TESTING. -ENDCLASS. - - -CLASS {{p}}t31_test IMPLEMENTATION. - - METHOD given. - DATA(lt_stations) = it_stations. - DATA(lt_moves) = it_moves. - - LOOP AT lt_stations ASSIGNING FIELD-SYMBOL(). - -client = sy-mandt. - ENDLOOP. - - LOOP AT lt_moves ASSIGNING FIELD-SYMBOL(). - -client = sy-mandt. - ENDLOOP. - - DELETE FROM {{p}}station. - DELETE FROM {{p}}move. - INSERT {{p}}station FROM TABLE @lt_stations. - INSERT {{p}}move FROM TABLE @lt_moves. - ENDMETHOD. - - METHOD rebalance. - CALL FUNCTION '{{P}}BIKE_REBALANCE' - EXPORTING - iv_dry_run = iv_dry_run - IMPORTING - ev_applied = ev_applied - ev_rejected = ev_rejected - EXCEPTIONS - OTHERS = 1. - cl_abap_unit_assert=>assert_subrc( exp = 0 ). - ENDMETHOD. - - METHOD bikes_of. - SELECT SINGLE bikes FROM {{p}}station - INTO @rv_bikes - WHERE station_id = @iv_id. - ENDMETHOD. - - METHOD applies_move. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 5 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 10 bikes = 0 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 3 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 2 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 3 ). - ENDMETHOD. - - METHOD rejects_move. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 1 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 10 bikes = 0 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 4 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 0 ). - ENDMETHOD. - - METHOD dry_run. - DATA lt_stations TYPE ty_stations. - DATA lt_moves TYPE ty_moves. - DATA lv_applied TYPE i. - DATA lv_rejected TYPE i. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Alpha' capacity = 10 bikes = 5 ) - ( station_id = 'S002' station_name = 'Beta' capacity = 10 bikes = 0 ) ). - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 2 ) ). - - given( it_stations = lt_stations it_moves = lt_moves ). - rebalance( EXPORTING iv_dry_run = abap_true - IMPORTING ev_applied = lv_applied ev_rejected = lv_rejected ). - - cl_abap_unit_assert=>assert_equals( act = lv_applied exp = 1 ). - cl_abap_unit_assert=>assert_equals( act = lv_rejected exp = 0 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S001' ) exp = 5 ). - cl_abap_unit_assert=>assert_equals( act = bikes_of( 'S002' ) exp = 0 ). - ENDMETHOD. - -ENDCLASS. diff --git a/tasks_gen/eval/G0122/reference/track_fee.func.abap b/tasks_gen/eval/G0122/reference/track_fee.func.abap new file mode 100644 index 0000000..56ba64b --- /dev/null +++ b/tasks_gen/eval/G0122/reference/track_fee.func.abap @@ -0,0 +1,87 @@ +FUNCTION {{p}}track_fee + IMPORTING + it_paths TYPE STANDARD TABLE + EXPORTING + et_fees TYPE STANDARD TABLE + EXCEPTIONS + invalid_distance + invalid_category. + + TYPES: BEGIN OF ty_sum, + train_cat TYPE c LENGTH 2, + path_count TYPE i, + total_km TYPE p LENGTH 13 DECIMALS 2, + total_fee TYPE p LENGTH 13 DECIMALS 2, + END OF ty_sum. + + DATA: lt_sums TYPE SORTED TABLE OF ty_sum WITH UNIQUE KEY train_cat, + lv_cat TYPE c LENGTH 2, + lv_km TYPE p LENGTH 13 DECIMALS 2, + lv_flag TYPE c LENGTH 1, + lv_rate TYPE p LENGTH 5 DECIMALS 2, + lv_raw TYPE decfloat34, + lv_fee TYPE p LENGTH 13 DECIMALS 2. + + FIELD-SYMBOLS: TYPE any, + TYPE any, + TYPE ty_sum, + TYPE any. + + CLEAR et_fees. + + LOOP AT it_paths ASSIGNING . + ASSIGN COMPONENT 'TRAIN_CAT' OF STRUCTURE TO . + lv_cat = . + ASSIGN COMPONENT 'DISTANCE_KM' OF STRUCTURE TO . + lv_km = . + ASSIGN COMPONENT 'NIGHT_FLAG' OF STRUCTURE TO . + lv_flag = . + + IF lv_km <= 0. + RAISE invalid_distance. + ENDIF. + + CASE lv_cat. + WHEN 'IC'. + lv_rate = '1.20'. + WHEN 'RG'. + lv_rate = '0.90'. + WHEN 'FR'. + lv_rate = '0.60'. + WHEN 'SP'. + lv_rate = '1.50'. + WHEN OTHERS. + RAISE invalid_category. + ENDCASE. + + lv_raw = lv_km * lv_rate. + IF lv_flag = 'X'. + lv_raw = lv_raw * 12 / 10. + ENDIF. + lv_fee = round( val = lv_raw dec = 2 mode = cl_abap_math=>round_half_up ). + IF lv_fee < 5. + lv_fee = 5. + ENDIF. + + READ TABLE lt_sums ASSIGNING WITH TABLE KEY train_cat = lv_cat. + IF sy-subrc <> 0. + INSERT VALUE ty_sum( train_cat = lv_cat ) INTO TABLE lt_sums ASSIGNING . + ENDIF. + -path_count = -path_count + 1. + -total_km = -total_km + lv_km. + -total_fee = -total_fee + lv_fee. + ENDLOOP. + + LOOP AT lt_sums ASSIGNING . + APPEND INITIAL LINE TO et_fees ASSIGNING . + ASSIGN COMPONENT 'TRAIN_CAT' OF STRUCTURE TO . + = -train_cat. + ASSIGN COMPONENT 'PATH_COUNT' OF STRUCTURE TO . + = -path_count. + ASSIGN COMPONENT 'TOTAL_KM' OF STRUCTURE TO . + = -total_km. + ASSIGN COMPONENT 'TOTAL_FEE' OF STRUCTURE TO . + = -total_fee. + ENDLOOP. + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0122/reference/track_test.clas.abap b/tasks_gen/eval/G0122/reference/track_test.clas.abap new file mode 100644 index 0000000..2b13f53 --- /dev/null +++ b/tasks_gen/eval/G0122/reference/track_test.clas.abap @@ -0,0 +1,75 @@ +CLASS {{p}}track_test DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + + PRIVATE SECTION. + TYPES ty_paths TYPE {{P}}TRACK_TYPES=>tt_path. + TYPES ty_fees TYPE {{P}}TRACK_TYPES=>tt_fee. + TYPES ty_money TYPE {{P}}TRACK_TYPES=>ty_money. + + METHODS fees_for + IMPORTING it_paths TYPE ty_paths + RETURNING VALUE(rt_fees) TYPE ty_fees. + + METHODS one_category FOR TESTING. + METHODS two_categories FOR TESTING. + METHODS night_surcharge FOR TESTING. + METHODS invalid_distance FOR TESTING. +ENDCLASS. + + +CLASS {{p}}track_test IMPLEMENTATION. + + METHOD fees_for. + CALL FUNCTION '{{P}}TRACK_FEE' + EXPORTING + it_paths = it_paths + IMPORTING + et_fees = rt_fees + EXCEPTIONS + invalid_distance = 1 + invalid_category = 2 + OTHERS = 3. + cl_abap_unit_assert=>assert_subrc( exp = 0 ). + ENDMETHOD. + + METHOD one_category. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'SP' distance_km = '10.00' night_flag = '' ) ). + DATA(lt_fees) = fees_for( lt_paths ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_fees ) ). + cl_abap_unit_assert=>assert_equals( exp = CONV ty_money( '15.00' ) act = lt_fees[ 1 ]-total_fee ). + ENDMETHOD. + + METHOD two_categories. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'RG' distance_km = '20.00' night_flag = '' ) + ( path_id = '00000002' train_cat = 'FR' distance_km = '20.00' night_flag = '' ) ). + DATA(lt_fees) = fees_for( lt_paths ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_fees ) ). + cl_abap_unit_assert=>assert_equals( exp = 'FR' act = lt_fees[ 1 ]-train_cat ). + cl_abap_unit_assert=>assert_equals( exp = 'RG' act = lt_fees[ 2 ]-train_cat ). + ENDMETHOD. + + METHOD night_surcharge. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'FR' distance_km = '50.00' night_flag = 'X' ) ). + DATA(lt_fees) = fees_for( lt_paths ). + cl_abap_unit_assert=>assert_equals( exp = CONV ty_money( '36.00' ) act = lt_fees[ 1 ]-total_fee ). + ENDMETHOD. + + METHOD invalid_distance. + DATA lt_paths TYPE ty_paths. + lt_paths = VALUE #( ( path_id = '00000001' train_cat = 'IC' distance_km = '0.00' night_flag = '' ) ). + DATA lt_fees TYPE ty_fees. + CALL FUNCTION '{{P}}TRACK_FEE' + EXPORTING + it_paths = lt_paths + IMPORTING + et_fees = lt_fees + EXCEPTIONS + invalid_distance = 1 + OTHERS = 2. + cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ). + ENDMETHOD. + +ENDCLASS. diff --git a/tasks_gen/eval/G0122/seed/move.tabl.abap b/tasks_gen/eval/G0122/seed/move.tabl.abap deleted file mode 100644 index b20a9c5..0000000 --- a/tasks_gen/eval/G0122/seed/move.tabl.abap +++ /dev/null @@ -1,12 +0,0 @@ -@EndUserText.label : 'Planned bike move' -@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE -@AbapCatalog.tableCategory : #TRANSPARENT -@AbapCatalog.deliveryClass : #A -@AbapCatalog.dataMaintenance : #RESTRICTED -define table {{p}}move { - key client : abap.clnt not null; - key move_no : abap.int4 not null; - source_id : abap.char(6) not null; - target_id : abap.char(6) not null; - quantity : abap.int4 not null; -} diff --git a/tasks_gen/eval/G0122/seed/seed_bike.clas.abap b/tasks_gen/eval/G0122/seed/seed_bike.clas.abap deleted file mode 100644 index 038f52d..0000000 --- a/tasks_gen/eval/G0122/seed/seed_bike.clas.abap +++ /dev/null @@ -1,39 +0,0 @@ -CLASS {{p}}seed_bike DEFINITION - PUBLIC FINAL CREATE PUBLIC. - - PUBLIC SECTION. - INTERFACES if_oo_adt_classrun. -ENDCLASS. - - -CLASS {{p}}seed_bike IMPLEMENTATION. - METHOD if_oo_adt_classrun~main. - DATA lt_stations TYPE STANDARD TABLE OF {{p}}station. - DATA lt_moves TYPE STANDARD TABLE OF {{p}}move. - - lt_stations = VALUE #( - ( station_id = 'S001' station_name = 'Central Square' capacity = 20 bikes = 12 ) - ( station_id = 'S002' station_name = 'Harbour' capacity = 15 bikes = 3 ) - ( station_id = 'S003' station_name = 'Main Station' capacity = 10 bikes = 10 ) ). - - lt_moves = VALUE #( - ( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 4 ) - ( move_no = 2 source_id = 'S002' target_id = 'S003' quantity = 2 ) ). - - LOOP AT lt_stations ASSIGNING FIELD-SYMBOL(). - -client = sy-mandt. - ENDLOOP. - - LOOP AT lt_moves ASSIGNING FIELD-SYMBOL(). - -client = sy-mandt. - ENDLOOP. - - DELETE FROM {{p}}station. - INSERT {{p}}station FROM TABLE @lt_stations. - - DELETE FROM {{p}}move. - INSERT {{p}}move FROM TABLE @lt_moves. - - out->write( 'Bike sharing sample data inserted.' ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0122/seed/station.tabl.abap b/tasks_gen/eval/G0122/seed/station.tabl.abap deleted file mode 100644 index 4e32d46..0000000 --- a/tasks_gen/eval/G0122/seed/station.tabl.abap +++ /dev/null @@ -1,12 +0,0 @@ -@EndUserText.label : 'Bike station' -@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE -@AbapCatalog.tableCategory : #TRANSPARENT -@AbapCatalog.deliveryClass : #A -@AbapCatalog.dataMaintenance : #RESTRICTED -define table {{p}}station { - key client : abap.clnt not null; - key station_id : abap.char(6) not null; - station_name : abap.char(30) not null; - capacity : abap.int4 not null; - bikes : abap.int4 not null; -} diff --git a/tasks_gen/eval/G0122/seed/track_sample.func.abap b/tasks_gen/eval/G0122/seed/track_sample.func.abap new file mode 100644 index 0000000..9bc5e28 --- /dev/null +++ b/tasks_gen/eval/G0122/seed/track_sample.func.abap @@ -0,0 +1,12 @@ +FUNCTION {{p}}track_sample + IMPORTING + it_paths TYPE STANDARD TABLE + EXPORTING + et_fees TYPE STANDARD TABLE + EXCEPTIONS + invalid_distance + invalid_category. + + CLEAR et_fees. + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0122/seed/track_types.clas.abap b/tasks_gen/eval/G0122/seed/track_types.clas.abap new file mode 100644 index 0000000..7ec8984 --- /dev/null +++ b/tasks_gen/eval/G0122/seed/track_types.clas.abap @@ -0,0 +1,28 @@ +CLASS {{p}}track_types DEFINITION + PUBLIC FINAL CREATE PUBLIC. + + PUBLIC SECTION. + TYPES: ty_id TYPE n LENGTH 8, + ty_cat TYPE c LENGTH 2, + ty_flag TYPE c LENGTH 1, + ty_km TYPE p LENGTH 13 DECIMALS 2, + ty_money TYPE p LENGTH 13 DECIMALS 2, + BEGIN OF ty_path, + path_id TYPE ty_id, + train_cat TYPE ty_cat, + distance_km TYPE ty_km, + night_flag TYPE ty_flag, + END OF ty_path, + tt_path TYPE STANDARD TABLE OF ty_path WITH EMPTY KEY, + BEGIN OF ty_fee, + train_cat TYPE ty_cat, + path_count TYPE i, + total_km TYPE ty_km, + total_fee TYPE ty_money, + END OF ty_fee, + tt_fee TYPE STANDARD TABLE OF ty_fee WITH EMPTY KEY. +ENDCLASS. + + +CLASS {{p}}track_types IMPLEMENTATION. +ENDCLASS. diff --git a/tasks_gen/eval/G0122/spec.md b/tasks_gen/eval/G0122/spec.md index 09035c8..8b7c973 100644 --- a/tasks_gen/eval/G0122/spec.md +++ b/tasks_gen/eval/G0122/spec.md @@ -1,85 +1,69 @@ # 1. Goal - -A bike-sharing operator moves bikes between its stations. A background job -calls one function module to apply the planned moves of the operator. The -function module reads the planned moves and the current state of the stations -from the database, applies the moves, and writes the new state of the stations -back to the database. The function module returns the number of applied moves -and the number of rejected moves. +A rail infrastructure manager charges a track access fee to train operating +companies. A billing program calls one function module for each operating day. +The function module calculates the fee of each train path and groups the result +by train category. # 2. Open questions - None. # 3. Context - -- Function group {{P}}FG_BIKE exists in package $TMP. -- Table {{P}}STATION exists in package $TMP. It holds the current state of the - stations of the operator. The table is client-dependent. -- Table {{P}}MOVE exists in package $TMP. It holds the planned moves. The table - is client-dependent. -- The station IDs in {{P}}STATION are unique. The move numbers in {{P}}MOVE are - unique. -- The function module reads and changes the two tables. It works on the data of - the current client. +- Function group {{P}}FG_TRACK exists in package $TMP. +- Function module {{P}}TRACK_SAMPLE exists in this group. It shows the interface + that the billing program uses. Do not change it. +- The global class {{P}}TRACK_TYPES exists in package $TMP. It only holds the row + types of the input and of the result. Do not change it. Its public types are: + - TY_PATH: PATH_ID (type N, length 8), TRAIN_CAT (type C, length 2), + DISTANCE_KM (packed, length 13, 2 decimals), NIGHT_FLAG (type C, length 1). + - TT_PATH: standard table of TY_PATH. + - TY_FEE: TRAIN_CAT (type C, length 2), PATH_COUNT (type I), TOTAL_KM (packed, + length 13, 2 decimals), TOTAL_FEE (packed, length 13, 2 decimals). + - TT_FEE: standard table of TY_FEE. +- The billing program builds a standard table with the components of TY_PATH and + reads a standard table with the components of TY_FEE. The component names are + the interface between the billing program and the function module. # 4. Contract - -Function module {{P}}BIKE_REBALANCE in the function group {{P}}FG_BIKE: - -IMPORTING - iv_dry_run TYPE abap_bool -EXPORTING - ev_applied TYPE i - ev_rejected TYPE i - -Table {{P}}STATION: - - client (key) - station_id (key) TYPE c LENGTH 6 - station_name TYPE c LENGTH 30 - capacity TYPE i - bikes TYPE i - -Table {{P}}MOVE: - - client (key) - move_no (key) TYPE i - source_id TYPE c LENGTH 6 - target_id TYPE c LENGTH 6 - quantity TYPE i +Create the function module {{P}}TRACK_FEE in function group {{P}}FG_TRACK with +this interface: +- Importing parameter IT_PATHS, type STANDARD TABLE. +- Exporting parameter ET_FEES, type STANDARD TABLE. +- Exceptions INVALID_DISTANCE and INVALID_CATEGORY. +The two table parameters are generic standard tables. Their row components are +fixed by TY_PATH and TY_FEE of {{P}}TRACK_TYPES. # 5. Business rules - -1. Read all rows of {{P}}STATION and all rows of {{P}}MOVE. -2. Apply the moves in ascending order of move_no. Do not apply them in the - order of the table. -3. A move is rejected if at least one of these conditions is true: - - quantity is less than or equal to 0; - - source_id and target_id are equal; - - source_id is not the ID of a station in {{P}}STATION; - - target_id is not the ID of a station in {{P}}STATION; - - the source station has fewer bikes than quantity; - - the target station has fewer free docks than quantity. The free docks of - a station are capacity minus bikes. -4. A rejected move does not change any station. -5. An accepted move subtracts quantity from the bikes of the source station - and adds quantity to the bikes of the target station. -6. After the last move, the function module writes the new bikes value of the - stations back to {{P}}STATION. station_name and capacity do not change. -7. If iv_dry_run is true, the function module does not change {{P}}STATION. -8. ev_applied is the number of accepted moves. ev_rejected is the number of - rejected moves. Both numbers are also returned if iv_dry_run is true. +1. A train path with DISTANCE_KM less than or equal to zero is not valid. Raise + the exception INVALID_DISTANCE. +2. The rate of a train category is: + - IC: 1.20 per kilometre + - RG: 0.90 per kilometre + - FR: 0.60 per kilometre + - SP: 1.50 per kilometre +3. A train category that is not in rule 2 is not valid. Raise the exception + INVALID_CATEGORY. +4. The fee of one path is DISTANCE_KM multiplied by the rate of its train + category. +5. If NIGHT_FLAG is 'X', multiply the fee of the path by 1.20. +6. Round the fee of the path half up to two decimals. +7. The minimum fee of one path is 5.00. If the fee of the path is less than + 5.00, use 5.00. +8. The result table has one row for each train category that occurs in the + input table. +9. PATH_COUNT is the number of paths of the category. +10. TOTAL_KM is the sum of DISTANCE_KM of the paths of the category. +11. TOTAL_FEE is the sum of the fees of the paths of the category. +12. Sort the result table in ascending order of TRAIN_CAT. +13. If the input table is empty, the result table is empty. Do not raise an + exception. # 6. Constraints - -- Release target: SAP_BASIS 816 (ABAP Platform 2025). -- Package: $TMP. Do not create a transport request. -- Clean ABAP. Keep the function module and every method below 40 statements. -- Out of scope: do not change {{P}}STATION, {{P}}MOVE and {{P}}SEED_BIKE. +- Release target: 8.16. +- Coding standard: Clean ABAP. Keep methods below 40 statements. Pass large + parameters by reference. +- Out of scope: do not change {{P}}TRACK_SAMPLE or {{P}}TRACK_TYPES. # 7. Acceptance - - The function module is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests for the function module in a global test class. diff --git a/tasks_gen/eval/G0122/task.json b/tasks_gen/eval/G0122/task.json index b62b79e..7adc332 100644 --- a/tasks_gen/eval/G0122/task.json +++ b/tasks_gen/eval/G0122/task.json @@ -11,77 +11,70 @@ }, "seed": [ { - "type": "TABL", - "name": "{{P}}STATION", - "file": "seed/station.tabl.abap", - "description": "Bike stations of the operator" - }, - { - "type": "TABL", - "name": "{{P}}MOVE", - "file": "seed/move.tabl.abap", - "description": "Planned bike moves" + "type": "CLAS", + "name": "{{P}}TRACK_TYPES", + "file": "seed/track_types.clas.abap", + "description": "Row types for train paths and track fees" }, { "type": "FUGR", - "name": "{{P}}FG_BIKE", - "description": "Bike sharing function group" + "name": "{{P}}FG_TRACK", + "description": "Track access fee" }, { - "type": "CLAS", - "name": "{{P}}SEED_BIKE", - "file": "seed/seed_bike.clas.abap", - "description": "Sample data for the two tables", - "run": true + "type": "FUNC", + "name": "{{P}}TRACK_SAMPLE", + "functionGroup": "{{P}}FG_TRACK", + "file": "seed/track_sample.func.abap", + "description": "Sample module that shows the interface of the billing program" } ], "contract": [ + { + "type": "CLAS", + "name": "{{P}}TRACK_TYPES" + }, { "type": "FUNC", - "name": "{{P}}BIKE_REBALANCE", - "functionGroup": "{{P}}FG_BIKE", + "name": "{{P}}TRACK_FEE", + "functionGroup": "{{P}}FG_TRACK", "params": [ { - "name": "iv_dry_run", - "type": "abap_bool" + "name": "it_paths", + "type": "STANDARD TABLE" }, { - "name": "ev_applied", - "type": "i" - }, - { - "name": "ev_rejected", - "type": "i" + "name": "et_fees", + "type": "STANDARD TABLE" } ] } ], "out_of_scope": [ - "{{P}}STATION", - "{{P}}MOVE", - "{{P}}SEED_BIKE" + "{{P}}TRACK_SAMPLE", + "{{P}}TRACK_TYPES" ], "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}T31_HIDDEN", - "file": "hidden/t31_hidden.clas.abap", - "description": "Hidden tests for the bike rebalancing" + "name": "{{P}}TRACK_HIDDEN", + "file": "hidden/track_hidden.clas.abap", + "description": "Hidden tests for the track access fee" } ], "reference": [ { "type": "FUNC", - "name": "{{P}}BIKE_REBALANCE", - "functionGroup": "{{P}}FG_BIKE", - "file": "reference/bike_rebalance.func.abap", - "description": "Reference implementation of the rebalancing" + "name": "{{P}}TRACK_FEE", + "functionGroup": "{{P}}FG_TRACK", + "file": "reference/track_fee.func.abap", + "description": "Track access fee module" }, { "type": "CLAS", - "name": "{{P}}T31_TEST", - "file": "reference/t31_test.clas.abap", - "description": "Own ABAP Unit tests for the function module" + "name": "{{P}}TRACK_TEST", + "file": "reference/track_test.clas.abap", + "description": "Own tests for the track access fee" } ], "craft_checks": [ diff --git a/tasks_gen/eval/G0123/empirical.json b/tasks_gen/eval/G0123/empirical.json new file mode 100644 index 0000000..6b0b206 --- /dev/null +++ b/tasks_gen/eval/G0123/empirical.json @@ -0,0 +1,17 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "failed_gates": [ + "G1_active", + "G2_contract", + "G3_hidden_runs" + ] + }, + "hidden": "0/0", + "tool_calls": 19, + "seconds": 826.4, + "run_dir": "runs/emp/11008_G0123_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0123/review.json b/tasks_gen/eval/G0123/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0123/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0124/empirical.json b/tasks_gen/eval/G0124/empirical.json new file mode 100644 index 0000000..d2d8e91 --- /dev/null +++ b/tasks_gen/eval/G0124/empirical.json @@ -0,0 +1,17 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "failed_gates": [ + "G1_active", + "G2_contract", + "G3_hidden_runs" + ] + }, + "hidden": "0/0", + "tool_calls": 60, + "seconds": 318.4, + "run_dir": "runs/emp/11009_G0124_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0124/faulty/m0_fleet_dist.prog.abap b/tasks_gen/eval/G0124/faulty/m0_fleet_dist.prog.abap new file mode 100644 index 0000000..b9ca138 --- /dev/null +++ b/tasks_gen/eval/G0124/faulty/m0_fleet_dist.prog.abap @@ -0,0 +1,127 @@ +REPORT {{p}}fleet_dist. + +TYPES: + BEGIN OF ty_line, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + distance TYPE i, + readings TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_depot TYPE RANGE OF {{p}}veh-depot. + +DATA gv_depot TYPE {{p}}veh-depot. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_depot FOR gv_depot. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + METHODS select_distances + IMPORTING iv_from TYPE d + iv_to TYPE d + it_depot TYPE tt_depot + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + TYPES: + BEGIN OF ty_raw, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + max_odo TYPE {{p}}odom-odometer, + min_odo TYPE {{p}}odom-odometer, + readings TYPE i, + END OF ty_raw, + tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_distances. + DATA lt_raw TYPE tt_raw. + SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo, + COUNT( * ) AS readings + FROM {{p}}veh AS v + INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id + WHERE o~read_date >= @iv_from + OR o~read_date <= @iv_to + AND v~depot IN @it_depot + GROUP BY v~veh_id, v~depot + HAVING COUNT( * ) >= 2 + INTO CORRESPONDING FIELDS OF TABLE @lt_raw. + LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(). + APPEND VALUE #( veh_id = -veh_id + depot = -depot + distance = -max_odo - -min_odo + readings = -readings ) TO rt_lines. + ENDLOOP. + SORT rt_lines BY distance DESCENDING veh_id ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS distances_per_vehicle FOR TESTING. + METHODS depot_filter FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( + i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ). + DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY. + lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' ) + ( veh_id = 'V2' depot = 'D2' ) + ( veh_id = 'V3' depot = 'D2' ) ). + go_env->insert_test_data( lt_veh ). + DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY. + lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 ) + ( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 ) + ( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 ) + ( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 ) + ( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 ) + ( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ). + go_env->insert_test_data( lt_odom ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD distances_per_vehicle. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ). + cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ). + ENDMETHOD. + + METHOD depot_filter. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' + it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0124/faulty/m1_fleet_dist.prog.abap b/tasks_gen/eval/G0124/faulty/m1_fleet_dist.prog.abap new file mode 100644 index 0000000..9aef0f7 --- /dev/null +++ b/tasks_gen/eval/G0124/faulty/m1_fleet_dist.prog.abap @@ -0,0 +1,127 @@ +REPORT {{p}}fleet_dist. + +TYPES: + BEGIN OF ty_line, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + distance TYPE i, + readings TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_depot TYPE RANGE OF {{p}}veh-depot. + +DATA gv_depot TYPE {{p}}veh-depot. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_depot FOR gv_depot. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + METHODS select_distances + IMPORTING iv_from TYPE d + iv_to TYPE d + it_depot TYPE tt_depot + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + TYPES: + BEGIN OF ty_raw, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + max_odo TYPE {{p}}odom-odometer, + min_odo TYPE {{p}}odom-odometer, + readings TYPE i, + END OF ty_raw, + tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_distances. + DATA lt_raw TYPE tt_raw. + SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo, + COUNT( * ) AS readings + FROM {{p}}veh AS v + INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id + WHERE o~read_date >= @iv_from + AND o~read_date <= @iv_to + OR v~depot IN @it_depot + GROUP BY v~veh_id, v~depot + HAVING COUNT( * ) >= 2 + INTO CORRESPONDING FIELDS OF TABLE @lt_raw. + LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(). + APPEND VALUE #( veh_id = -veh_id + depot = -depot + distance = -max_odo - -min_odo + readings = -readings ) TO rt_lines. + ENDLOOP. + SORT rt_lines BY distance DESCENDING veh_id ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS distances_per_vehicle FOR TESTING. + METHODS depot_filter FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( + i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ). + DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY. + lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' ) + ( veh_id = 'V2' depot = 'D2' ) + ( veh_id = 'V3' depot = 'D2' ) ). + go_env->insert_test_data( lt_veh ). + DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY. + lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 ) + ( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 ) + ( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 ) + ( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 ) + ( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 ) + ( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ). + go_env->insert_test_data( lt_odom ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD distances_per_vehicle. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ). + cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ). + ENDMETHOD. + + METHOD depot_filter. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' + it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0124/faulty/m2_fleet_dist.prog.abap b/tasks_gen/eval/G0124/faulty/m2_fleet_dist.prog.abap new file mode 100644 index 0000000..06c7807 --- /dev/null +++ b/tasks_gen/eval/G0124/faulty/m2_fleet_dist.prog.abap @@ -0,0 +1,127 @@ +REPORT {{p}}fleet_dist. + +TYPES: + BEGIN OF ty_line, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + distance TYPE i, + readings TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_depot TYPE RANGE OF {{p}}veh-depot. + +DATA gv_depot TYPE {{p}}veh-depot. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_depot FOR gv_depot. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + METHODS select_distances + IMPORTING iv_from TYPE d + iv_to TYPE d + it_depot TYPE tt_depot + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + TYPES: + BEGIN OF ty_raw, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + max_odo TYPE {{p}}odom-odometer, + min_odo TYPE {{p}}odom-odometer, + readings TYPE i, + END OF ty_raw, + tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_distances. + DATA lt_raw TYPE tt_raw. + SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo, + COUNT( * ) AS readings + FROM {{p}}veh AS v + INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id + WHERE o~read_date >= @iv_from + AND o~read_date <= @iv_to + AND v~depot IN @it_depot + GROUP BY v~veh_id, v~depot + HAVING COUNT( * ) < 2 + INTO CORRESPONDING FIELDS OF TABLE @lt_raw. + LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(). + APPEND VALUE #( veh_id = -veh_id + depot = -depot + distance = -max_odo - -min_odo + readings = -readings ) TO rt_lines. + ENDLOOP. + SORT rt_lines BY distance DESCENDING veh_id ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS distances_per_vehicle FOR TESTING. + METHODS depot_filter FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( + i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ). + DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY. + lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' ) + ( veh_id = 'V2' depot = 'D2' ) + ( veh_id = 'V3' depot = 'D2' ) ). + go_env->insert_test_data( lt_veh ). + DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY. + lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 ) + ( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 ) + ( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 ) + ( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 ) + ( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 ) + ( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ). + go_env->insert_test_data( lt_odom ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD distances_per_vehicle. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ). + cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ). + ENDMETHOD. + + METHOD depot_filter. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' + it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0124/faulty/m3_fleet_dist.prog.abap b/tasks_gen/eval/G0124/faulty/m3_fleet_dist.prog.abap new file mode 100644 index 0000000..4115263 --- /dev/null +++ b/tasks_gen/eval/G0124/faulty/m3_fleet_dist.prog.abap @@ -0,0 +1,127 @@ +REPORT {{p}}fleet_dist. + +TYPES: + BEGIN OF ty_line, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + distance TYPE i, + readings TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_depot TYPE RANGE OF {{p}}veh-depot. + +DATA gv_depot TYPE {{p}}veh-depot. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_depot FOR gv_depot. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + METHODS select_distances + IMPORTING iv_from TYPE d + iv_to TYPE d + it_depot TYPE tt_depot + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + TYPES: + BEGIN OF ty_raw, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + max_odo TYPE {{p}}odom-odometer, + min_odo TYPE {{p}}odom-odometer, + readings TYPE i, + END OF ty_raw, + tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_distances. + DATA lt_raw TYPE tt_raw. + SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo, + COUNT( * ) AS readings + FROM {{p}}veh AS v + INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id + WHERE o~read_date >= @iv_from + AND o~read_date <= @iv_to + AND v~depot IN @it_depot + GROUP BY v~veh_id, v~depot + HAVING COUNT( * ) >= 3 + INTO CORRESPONDING FIELDS OF TABLE @lt_raw. + LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(). + APPEND VALUE #( veh_id = -veh_id + depot = -depot + distance = -max_odo - -min_odo + readings = -readings ) TO rt_lines. + ENDLOOP. + SORT rt_lines BY distance DESCENDING veh_id ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS distances_per_vehicle FOR TESTING. + METHODS depot_filter FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( + i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ). + DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY. + lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' ) + ( veh_id = 'V2' depot = 'D2' ) + ( veh_id = 'V3' depot = 'D2' ) ). + go_env->insert_test_data( lt_veh ). + DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY. + lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 ) + ( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 ) + ( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 ) + ( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 ) + ( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 ) + ( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ). + go_env->insert_test_data( lt_odom ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD distances_per_vehicle. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ). + cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ). + ENDMETHOD. + + METHOD depot_filter. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' + it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0124/faulty/m4_fleet_dist.prog.abap b/tasks_gen/eval/G0124/faulty/m4_fleet_dist.prog.abap new file mode 100644 index 0000000..8005692 --- /dev/null +++ b/tasks_gen/eval/G0124/faulty/m4_fleet_dist.prog.abap @@ -0,0 +1,127 @@ +REPORT {{p}}fleet_dist. + +TYPES: + BEGIN OF ty_line, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + distance TYPE i, + readings TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_depot TYPE RANGE OF {{p}}veh-depot. + +DATA gv_depot TYPE {{p}}veh-depot. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_depot FOR gv_depot. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + METHODS select_distances + IMPORTING iv_from TYPE d + iv_to TYPE d + it_depot TYPE tt_depot + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + TYPES: + BEGIN OF ty_raw, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + max_odo TYPE {{p}}odom-odometer, + min_odo TYPE {{p}}odom-odometer, + readings TYPE i, + END OF ty_raw, + tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_distances. + DATA lt_raw TYPE tt_raw. + SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo, + COUNT( * ) AS readings + FROM {{p}}veh AS v + INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id + WHERE o~read_date >= @iv_from + AND o~read_date <= @iv_to + AND v~depot IN @it_depot + GROUP BY v~veh_id, v~depot + HAVING COUNT( * ) >= 2 + INTO CORRESPONDING FIELDS OF TABLE @lt_raw. + LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(). + APPEND VALUE #( veh_id = -veh_id + depot = -depot + distance = -max_odo + -min_odo + readings = -readings ) TO rt_lines. + ENDLOOP. + SORT rt_lines BY distance DESCENDING veh_id ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS distances_per_vehicle FOR TESTING. + METHODS depot_filter FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( + i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ). + DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY. + lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' ) + ( veh_id = 'V2' depot = 'D2' ) + ( veh_id = 'V3' depot = 'D2' ) ). + go_env->insert_test_data( lt_veh ). + DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY. + lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 ) + ( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 ) + ( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 ) + ( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 ) + ( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 ) + ( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ). + go_env->insert_test_data( lt_odom ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD distances_per_vehicle. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ). + cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ). + ENDMETHOD. + + METHOD depot_filter. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' + it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0124/generation.json b/tasks_gen/eval/G0124/generation.json new file mode 100644 index 0000000..fc376f9 --- /dev/null +++ b/tasks_gen/eval/G0124/generation.json @@ -0,0 +1,19 @@ +{ + "id": "G0124", + "pool": "eval", + "object_type": "PROG", + "category": "C", + "attempts": [ + { + "stage": "validate", + "oracle": 100.0, + "null": 0, + "mutation": { + "valid": 5, + "killed": 5, + "ok": true + } + } + ], + "accepted": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0124/hidden/fleet_hidden.clas.abap b/tasks_gen/eval/G0124/hidden/fleet_hidden.clas.abap new file mode 100644 index 0000000..13c39b6 --- /dev/null +++ b/tasks_gen/eval/G0124/hidden/fleet_hidden.clas.abap @@ -0,0 +1,134 @@ +CLASS {{p}}fleet_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + TYPES tt_depot TYPE RANGE OF {{p}}veh-depot. + METHODS run + IMPORTING iv_from TYPE d + iv_to TYPE d + it_depot TYPE tt_depot OPTIONAL + RETURNING VALUE(rr_data) TYPE REF TO data. + METHODS value_of + IMPORTING ir_data TYPE REF TO data + iv_row TYPE i + iv_col TYPE string + RETURNING VALUE(rv_value) TYPE string. + METHODS lines_of + IMPORTING ir_data TYPE REF TO data + RETURNING VALUE(rv_lines) TYPE i. + METHODS all_vehicles FOR TESTING. + METHODS sorted_by_distance FOR TESTING. + METHODS distance_and_readings FOR TESTING. + METHODS depot_filter FOR TESTING. + METHODS date_filter FOR TESTING. + METHODS tie_break_by_veh_id FOR TESTING. + METHODS single_reading_excluded FOR TESTING. + METHODS unknown_vehicle_excluded FOR TESTING. +ENDCLASS. + + +CLASS {{p}}fleet_hidden IMPLEMENTATION. + METHOD run. + cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ). + SUBMIT {{p}}fleet_dist + WITH p_from = iv_from + WITH p_to = iv_to + WITH s_depot IN it_depot + AND RETURN. + TRY. + cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ). + CATCH cx_salv_bs_sc_runtime_info. + ENDTRY. + cl_salv_bs_runtime_info=>clear_all( ). + ENDMETHOD. + + METHOD lines_of. + FIELD-SYMBOLS TYPE STANDARD TABLE. + IF ir_data IS BOUND. + ASSIGN ir_data->* TO . + rv_lines = lines( ). + ENDIF. + ENDMETHOD. + + METHOD value_of. + FIELD-SYMBOLS TYPE STANDARD TABLE. + ASSIGN ir_data->* TO . + ASSIGN [ iv_row ] TO FIELD-SYMBOL(). + ASSIGN COMPONENT iv_col OF STRUCTURE TO FIELD-SYMBOL(). + cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Column { iv_col } missing| ). + rv_value = condense( CONV string( ) ). + ENDMETHOD. + + METHOD all_vehicles. + cl_abap_unit_assert=>assert_equals( + exp = 3 + act = lines_of( run( iv_from = '20260101' iv_to = '20260131' ) ) ). + ENDMETHOD. + + METHOD sorted_by_distance. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( + exp = `V3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `V2` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `VEH_ID` ) ). + ENDMETHOD. + + METHOD distance_and_readings. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( + exp = `600` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DISTANCE` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `4` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `READINGS` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `D1` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `DEPOT` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `200` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `DISTANCE` ) ). + ENDMETHOD. + + METHOD depot_filter. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' + it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D1' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( + exp = `V1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `500` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DISTANCE` ) ). + ENDMETHOD. + + METHOD date_filter. + DATA(lr_data) = run( iv_from = '20260111' iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( + exp = `V3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `300` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DISTANCE` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `READINGS` ) ). + ENDMETHOD. + + METHOD tie_break_by_veh_id. + DATA(lr_data) = run( iv_from = '20251201' iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( + exp = `V1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `V3` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `VEH_ID` ) ). + ENDMETHOD. + + METHOD single_reading_excluded. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260110' ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( + exp = `V1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `200` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DISTANCE` ) ). + ENDMETHOD. + + METHOD unknown_vehicle_excluded. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260116' ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( + exp = `V3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `V2` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `VEH_ID` ) ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0124/hidden/t20_hidden.clas.abap b/tasks_gen/eval/G0124/hidden/t20_hidden.clas.abap deleted file mode 100644 index 741c006..0000000 --- a/tasks_gen/eval/G0124/hidden/t20_hidden.clas.abap +++ /dev/null @@ -1,212 +0,0 @@ -CLASS {{p}}t20_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - TYPES tt_region TYPE RANGE OF {{p}}farm-region. - METHODS run - IMPORTING iv_from TYPE d - iv_to TYPE d - it_region TYPE tt_region OPTIONAL - RETURNING VALUE(rr_data) TYPE REF TO data. - METHODS value_of - IMPORTING ir_data TYPE REF TO data - iv_row TYPE i - iv_col TYPE string - RETURNING VALUE(rv_value) TYPE string. - METHODS lines_of - IMPORTING ir_data TYPE REF TO data - RETURNING VALUE(rv_lines) TYPE i. - METHODS all_farms_listed FOR TESTING. - METHODS litres_summed FOR TESTING. - METHODS delivery_count FOR TESTING. - METHODS date_bounds FOR TESTING. - METHODS date_range_wide FOR TESTING. - METHODS region_filter FOR TESTING. - METHODS region_exclude FOR TESTING. - METHODS sorted_by_litres FOR TESTING. - METHODS tie_break_farm_id FOR TESTING. -ENDCLASS. - - -CLASS {{p}}t20_hidden IMPLEMENTATION. - METHOD run. - cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ). - SUBMIT {{p}}milk_sum WITH p_from = iv_from WITH p_to = iv_to - WITH s_reg IN it_region AND RETURN. - TRY. - cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ). - CATCH cx_salv_bs_sc_runtime_info. - ENDTRY. - cl_salv_bs_runtime_info=>clear_all( ). -  ENDMETHOD. - - METHOD lines_of. - FIELD-SYMBOLS TYPE STANDARD TABLE. - IF ir_data IS BOUND. - ASSIGN ir_data->* TO . - rv_lines = lines( ). - ENDIF. - ENDMETHOD. - - METHOD value_of. - FIELD-SYMBOLS TYPE STANDARD TABLE. - ASSIGN ir_data->* TO . - ASSIGN [ iv_row ] TO FIELD-SYMBOL(). - ASSIGN COMPONENT iv_col OF STRUCTURE TO FIELD-SYMBOL(). - cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Column { iv_col } missing| ). - rv_value = condense( CONV string( ) ). - ENDMETHOD. - - METHOD all_farms_listed. - cl_abap_unit_assert=>assert_equals( - exp = 5 - act = lines_of( run( iv_from = '20260101' iv_to = '20260131' ) ) ). - cl_abap_unit_assert=>assert_equals( - exp = 2 - act = lines_of( run( iv_from = '20260101' iv_to = '20260131' - it_region = VALUE #( ( sign = 'I' option = 'EQ' low = 'CH' ) ) ) ) ). - ENDMETHOD. - - METHOD litres_summed. - DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). - cl_abap_unit_assert=>assert_equals( exp = `1000` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `200.50` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LITRES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1001` - act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `200.00` - act = value_of( ir_data = lr_data iv_row = 2 iv_col = `LITRES` ) ). - ENDMETHOD. - - METHOD delivery_count. - DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). - cl_abap_unit_assert=>assert_equals( exp = `2` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DELIVERIES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1` - act = value_of( ir_data = lr_data iv_row = 3 iv_col = `DELIVERIES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1003` - act = value_of( ir_data = lr_data iv_row = 5 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `0` - act = value_of( ir_data = lr_data iv_row = 5 iv_col = `DELIVERIES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `0.00` - act = value_of( ir_data = lr_data iv_row = 5 iv_col = `LITRES` ) ). - ENDMETHOD. - - METHOD date_bounds. - DATA(lr_one) = run( iv_from = '20260105' iv_to = '20260105' ). - cl_abap_unit_assert=>assert_equals( exp = 5 act = lines_of( lr_one ) ). - cl_abap_unit_assert=>assert_equals( exp = `1000` - act = value_of( ir_data = lr_one iv_row = 1 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `120.50` - act = value_of( ir_data = lr_one iv_row = 1 iv_col = `LITRES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1` - act = value_of( ir_data = lr_one iv_row = 1 iv_col = `DELIVERIES` ) ). - - DATA(lr_two) = run( iv_from = '20260105' iv_to = '20260106' ). - cl_abap_unit_assert=>assert_equals( exp = 5 act = lines_of( lr_two ) ). - cl_abap_unit_assert=>assert_equals( exp = `1001` - act = value_of( ir_data = lr_two iv_row = 1 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `200.00` - act = value_of( ir_data = lr_two iv_row = 1 iv_col = `LITRES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1000` - act = value_of( ir_data = lr_two iv_row = 2 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `120.50` - act = value_of( ir_data = lr_two iv_row = 2 iv_col = `LITRES` ) ). - ENDMETHOD. - - METHOD date_range_wide. - DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260228' ). - cl_abap_unit_assert=>assert_equals( exp = `1001` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `240.00` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LITRES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `2` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DELIVERIES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1000` - act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `200.50` - act = value_of( ir_data = lr_data iv_row = 2 iv_col = `LITRES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `2` - act = value_of( ir_data = lr_data iv_row = 2 iv_col = `DELIVERIES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1003` - act = value_of( ir_data = lr_data iv_row = 5 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `0.00` - act = value_of( ir_data = lr_data iv_row = 5 iv_col = `LITRES` ) ). - ENDMETHOD. - - METHOD region_filter. - DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' - it_region = VALUE #( ( sign = 'I' option = 'EQ' low = 'CH' ) ) ). - cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ). - cl_abap_unit_assert=>assert_equals( exp = `1000` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `200.50` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LITRES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1001` - act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `200.00` - act = value_of( ir_data = lr_data iv_row = 2 iv_col = `LITRES` ) ). - ENDMETHOD. - - METHOD region_exclude. - DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' - it_region = VALUE #( ( sign = 'E' option = 'EQ' low = 'CH' ) ) ). - cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( lr_data ) ). - cl_abap_unit_assert=>assert_equals( exp = `1002` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `50.25` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LITRES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1004` - act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `50.25` - act = value_of( ir_data = lr_data iv_row = 2 iv_col = `LITRES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1003` - act = value_of( ir_data = lr_data iv_row = 3 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `0.00` - act = value_of( ir_data = lr_data iv_row = 3 iv_col = `LITRES` ) ). - ENDMETHOD. - - METHOD sorted_by_litres. - DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). - cl_abap_unit_assert=>assert_equals( exp = `1000` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1001` - act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1002` - act = value_of( ir_data = lr_data iv_row = 3 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1004` - act = value_of( ir_data = lr_data iv_row = 4 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1003` - act = value_of( ir_data = lr_data iv_row = 5 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `Alpine Dairy` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_NAME` ) ). - cl_abap_unit_assert=>assert_equals( exp = `CH` - act = value_of( ir_data = lr_data iv_row = 1 iv_col = `REGION` ) ). - cl_abap_unit_assert=>assert_equals( exp = `Hilltop Farm` - act = value_of( ir_data = lr_data iv_row = 5 iv_col = `FARM_NAME` ) ). - cl_abap_unit_assert=>assert_equals( exp = `AT` - act = value_of( ir_data = lr_data iv_row = 5 iv_col = `REGION` ) ). - ENDMETHOD. - - METHOD tie_break_farm_id. - DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). - cl_abap_unit_assert=>assert_equals( exp = `50.25` - act = value_of( ir_data = lr_data iv_row = 3 iv_col = `LITRES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `50.25` - act = value_of( ir_data = lr_data iv_row = 4 iv_col = `LITRES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1002` - act = value_of( ir_data = lr_data iv_row = 3 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1004` - act = value_of( ir_data = lr_data iv_row = 4 iv_col = `FARM_ID` ) ). - - DATA(lr_zero) = run( iv_from = '20260105' iv_to = '20260105' ). - cl_abap_unit_assert=>assert_equals( exp = `1001` - act = value_of( ir_data = lr_zero iv_row = 2 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1002` - act = value_of( ir_data = lr_zero iv_row = 3 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1003` - act = value_of( ir_data = lr_zero iv_row = 4 iv_col = `FARM_ID` ) ). - cl_abap_unit_assert=>assert_equals( exp = `1004` - act = value_of( ir_data = lr_zero iv_row = 5 iv_col = `FARM_ID` ) ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0124/mutation.json b/tasks_gen/eval/G0124/mutation.json index a2508c3..280748a 100644 --- a/tasks_gen/eval/G0124/mutation.json +++ b/tasks_gen/eval/G0124/mutation.json @@ -1,96 +1,81 @@ { - "task": "T20", + "task": "G0124", "mutants": [ { - "object": "{{P}}MILK_SUM", - "mutant": "BETWEEN -> >= only (rel)", + "object": "{{P}}FLEET_DIST", + "mutant": "line 48: AND -> OR (logic)", "status": "killed", - "hidden": "0/9", + "hidden": "2/8", "failed_tests": [ - "ALL_FARMS_LISTED", - "LITRES_SUMMED", - "DELIVERY_COUNT", - "DATE_BOUNDS", - "DATE_RANGE_WIDE", - "REGION_FILTER", - "REGION_EXCLUDE", - "SORTED_BY_LITRES", - "TIE_BREAK_FARM_ID" + "DATE_FILTER", + "DEPOT_FILTER", + "DISTANCE_AND_READINGS", + "SINGLE_READING_EXCLUDED", + "SORTED_BY_DISTANCE", + "UNKNOWN_VEHICLE_EXCLUDED" ] }, { - "object": "{{P}}MILK_SUM", - "mutant": "BETWEEN -> <= only (rel)", + "object": "{{P}}FLEET_DIST", + "mutant": "line 49: AND -> OR (logic)", "status": "killed", - "hidden": "0/9", + "hidden": "2/8", "failed_tests": [ - "LITRES_SUMMED", - "DATE_BOUNDS", - "DATE_RANGE_WIDE", - "SORTED_BY_LITRES", - "TIE_BREAK_FARM_ID" + "DATE_FILTER", + "DEPOT_FILTER", + "DISTANCE_AND_READINGS", + "SINGLE_READING_EXCLUDED", + "SORTED_BY_DISTANCE", + "UNKNOWN_VEHICLE_EXCLUDED" ] }, { - "object": "{{P}}MILK_SUM", - "mutant": "region IN -> region NOT IN (logic)", + "object": "{{P}}FLEET_DIST", + "mutant": "line 51: >= -> < (rel)", "status": "killed", - "hidden": "0/9", + "hidden": "0/8", "failed_tests": [ - "ALL_FARMS_LISTED", - "LITRES_SUMMED", - "DELIVERY_COUNT", - "DATE_BOUNDS", - "DATE_RANGE_WIDE", - "REGION_FILTER", - "REGION_EXCLUDE", - "SORTED_BY_LITRES", - "TIE_BREAK_FARM_ID" + "ALL_VEHICLES", + "DATE_FILTER", + "DEPOT_FILTER", + "DISTANCE_AND_READINGS", + "SINGLE_READING_EXCLUDED", + "SORTED_BY_DISTANCE", + "TIE_BREAK_BY_VEH_ID", + "UNKNOWN_VEHICLE_EXCLUDED" ] }, { - "object": "{{P}}MILK_SUM", - "mutant": "farm without delivery skipped (inner join)", + "object": "{{P}}FLEET_DIST", + "mutant": "line 51: 2 -> 3 (const)", "status": "killed", - "hidden": "0/9", + "hidden": "1/8", "failed_tests": [ - "ALL_FARMS_LISTED", - "DELIVERY_COUNT", - "DATE_BOUNDS", - "DATE_RANGE_WIDE", - "REGION_EXCLUDE", - "SORTED_BY_LITRES", - "TIE_BREAK_FARM_ID" + "ALL_VEHICLES", + "DEPOT_FILTER", + "DISTANCE_AND_READINGS", + "SINGLE_READING_EXCLUDED", + "SORTED_BY_DISTANCE", + "TIE_BREAK_BY_VEH_ID", + "UNKNOWN_VEHICLE_EXCLUDED" ] }, { - "object": "{{P}}MILK_SUM", - "mutant": "SORT litres DESCENDING -> ASCENDING (rel)", + "object": "{{P}}FLEET_DIST", + "mutant": "line 56: - -> + (arith)", "status": "killed", - "hidden": "0/9", + "hidden": "3/8", "failed_tests": [ - "LITRES_SUMMED", - "DATE_BOUNDS", - "DATE_RANGE_WIDE", - "REGION_FILTER", - "REGION_EXCLUDE", - "SORTED_BY_LITRES", - "TIE_BREAK_FARM_ID" - ] - }, - { - "object": "{{P}}MILK_SUM", - "mutant": "secondary sort farm_id removed (tie)", - "status": "killed", - "hidden": "0/9", - "failed_tests": [ - "SORTED_BY_LITRES", - "TIE_BREAK_FARM_ID" + "DATE_FILTER", + "DEPOT_FILTER", + "DISTANCE_AND_READINGS", + "SINGLE_READING_EXCLUDED", + "TIE_BREAK_BY_VEH_ID" ] } ], - "valid": 6, - "killed": 6, + "valid": 5, + "killed": 5, "kill_rate": 1.0, "ok": true } \ No newline at end of file diff --git a/tasks_gen/eval/G0124/reference/fleet_dist.prog.abap b/tasks_gen/eval/G0124/reference/fleet_dist.prog.abap new file mode 100644 index 0000000..20c17dd --- /dev/null +++ b/tasks_gen/eval/G0124/reference/fleet_dist.prog.abap @@ -0,0 +1,127 @@ +REPORT {{p}}fleet_dist. + +TYPES: + BEGIN OF ty_line, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + distance TYPE i, + readings TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_depot TYPE RANGE OF {{p}}veh-depot. + +DATA gv_depot TYPE {{p}}veh-depot. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_depot FOR gv_depot. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + METHODS select_distances + IMPORTING iv_from TYPE d + iv_to TYPE d + it_depot TYPE tt_depot + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + TYPES: + BEGIN OF ty_raw, + veh_id TYPE {{p}}veh-veh_id, + depot TYPE {{p}}veh-depot, + max_odo TYPE {{p}}odom-odometer, + min_odo TYPE {{p}}odom-odometer, + readings TYPE i, + END OF ty_raw, + tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_distances. + DATA lt_raw TYPE tt_raw. + SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo, + COUNT( * ) AS readings + FROM {{p}}veh AS v + INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id + WHERE o~read_date >= @iv_from + AND o~read_date <= @iv_to + AND v~depot IN @it_depot + GROUP BY v~veh_id, v~depot + HAVING COUNT( * ) >= 2 + INTO CORRESPONDING FIELDS OF TABLE @lt_raw. + LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(). + APPEND VALUE #( veh_id = -veh_id + depot = -depot + distance = -max_odo - -min_odo + readings = -readings ) TO rt_lines. + ENDLOOP. + SORT rt_lines BY distance DESCENDING veh_id ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS distances_per_vehicle FOR TESTING. + METHODS depot_filter FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( + i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ). + DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY. + lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' ) + ( veh_id = 'V2' depot = 'D2' ) + ( veh_id = 'V3' depot = 'D2' ) ). + go_env->insert_test_data( lt_veh ). + DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY. + lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 ) + ( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 ) + ( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 ) + ( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 ) + ( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 ) + ( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ). + go_env->insert_test_data( lt_odom ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD distances_per_vehicle. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ). + cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ). + ENDMETHOD. + + METHOD depot_filter. + DATA(lt_lines) = NEW lcl_report( )->select_distances( + iv_from = '20260101' iv_to = '20260131' + it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ). + cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0124/reference/milk_sum.prog.abap b/tasks_gen/eval/G0124/reference/milk_sum.prog.abap deleted file mode 100644 index 82a72bc..0000000 --- a/tasks_gen/eval/G0124/reference/milk_sum.prog.abap +++ /dev/null @@ -1,170 +0,0 @@ -REPORT {{p}}milk_sum. - -DATA gv_region TYPE {{p}}farm-region. - -PARAMETERS p_from TYPE d OBLIGATORY. -PARAMETERS p_to TYPE d OBLIGATORY. -SELECT-OPTIONS s_reg FOR gv_region. - -CLASS lcl_report DEFINITION FINAL. - PUBLIC SECTION. - TYPES: - BEGIN OF ty_line, - farm_id TYPE {{p}}farm-farm_id, - farm_name TYPE {{p}}farm-farm_name, - region TYPE {{p}}farm-region, - litres TYPE {{p}}milk-litres, - deliveries TYPE i, - END OF ty_line, - tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, - tt_region TYPE RANGE OF {{p}}farm-region. - METHODS select_data - IMPORTING iv_from TYPE d - iv_to TYPE d - it_region TYPE tt_region - RETURNING VALUE(rt_lines) TYPE tt_line. - METHODS display - CHANGING ct_lines TYPE tt_line. - PRIVATE SECTION. - TYPES: - BEGIN OF ty_sum, - farm_id TYPE {{p}}milk-farm_id, - litres TYPE {{p}}milk-litres, - deliveries TYPE i, - END OF ty_sum, - tt_sum TYPE HASHED TABLE OF ty_sum WITH UNIQUE KEY farm_id. - METHODS sum_deliveries - IMPORTING iv_from TYPE d - iv_to TYPE d - RETURNING VALUE(rt_sum) TYPE tt_sum. -ENDCLASS. - -CLASS lcl_report IMPLEMENTATION. - METHOD select_data. - SELECT farm_id, farm_name, region - FROM {{p}}farm - WHERE region IN @it_region - INTO TABLE @DATA(lt_farm). - - DATA(lt_sum) = sum_deliveries( iv_from = iv_from iv_to = iv_to ). - - LOOP AT lt_farm INTO DATA(ls_farm). - DATA(ls_line) = VALUE ty_line( farm_id = ls_farm-farm_id - farm_name = ls_farm-farm_name - region = ls_farm-region ). - READ TABLE lt_sum ASSIGNING FIELD-SYMBOL() - WITH TABLE KEY farm_id = ls_farm-farm_id. - IF sy-subrc = 0. - ls_line-litres = -litres. - ls_line-deliveries = -deliveries. - ENDIF. - APPEND ls_line TO rt_lines. - ENDLOOP. - - SORT rt_lines BY litres DESCENDING farm_id ASCENDING. - ENDMETHOD. - - METHOD sum_deliveries. - SELECT farm_id, litres - FROM {{p}}milk - WHERE deliv_date BETWEEN @iv_from AND @iv_to - INTO TABLE @DATA(lt_milk). - - LOOP AT lt_milk INTO DATA(ls_milk). - READ TABLE rt_sum ASSIGNING FIELD-SYMBOL() - WITH TABLE KEY farm_id = ls_milk-farm_id. - IF sy-subrc <> 0. - DATA(ls_new) = VALUE ty_sum( farm_id = ls_milk-farm_id ). - INSERT ls_new INTO TABLE rt_sum ASSIGNING . - ENDIF. - -litres += ls_milk-litres. - -deliveries += 1. - ENDLOOP. - ENDMETHOD. - - METHOD display. - TRY. - cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) - CHANGING t_table = ct_lines ). - lo_alv->display( ). - CATCH cx_salv_msg INTO DATA(lx_error). - MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. - ENDTRY. - ENDMETHOD. -ENDCLASS. - -START-OF-SELECTION. - DATA(go_report) = NEW lcl_report( ). - DATA(gt_lines) = go_report->select_data( iv_from = p_from iv_to = p_to it_region = s_reg[] ). - go_report->display( CHANGING ct_lines = gt_lines ). - -CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - CLASS-DATA go_env TYPE REF TO if_osql_test_environment. - CLASS-METHODS class_setup. - CLASS-METHODS class_teardown. - METHODS sums_and_counts FOR TESTING. - METHODS missing_delivery FOR TESTING. - METHODS date_range FOR TESTING. - METHODS tie_break FOR TESTING. -ENDCLASS. - -CLASS ltc_report IMPLEMENTATION. - METHOD class_setup. - go_env = cl_osql_test_environment=>create( - i_dependency_list = VALUE #( ( '{{P}}FARM' ) ( '{{P}}MILK' ) ) ). - DATA lt_farm TYPE STANDARD TABLE OF {{p}}farm WITH EMPTY KEY. - lt_farm = VALUE #( ( farm_id = '1' farm_name = 'A' region = 'X' ) - ( farm_id = '2' farm_name = 'B' region = 'X' ) - ( farm_id = '3' farm_name = 'C' region = 'Y' ) - ( farm_id = '4' farm_name = 'D' region = 'Y' ) - ( farm_id = '5' farm_name = 'E' region = 'X' ) ). - go_env->insert_test_data( lt_farm ). - DATA lt_milk TYPE STANDARD TABLE OF {{p}}milk WITH EMPTY KEY. - lt_milk = VALUE #( ( deliv_id = 1 farm_id = '1' deliv_date = '20260110' litres = 10 ) - ( deliv_id = 2 farm_id = '1' deliv_date = '20260120' litres = 5 ) - ( deliv_id = 3 farm_id = '2' deliv_date = '20260115' litres = 40 ) - ( deliv_id = 4 farm_id = '3' deliv_date = '20260116' litres = 20 ) - ( deliv_id = 5 farm_id = '5' deliv_date = '20260111' litres = 15 ) ). - go_env->insert_test_data( lt_milk ). - ENDMETHOD. - - METHOD class_teardown. - go_env->destroy( ). - ENDMETHOD. - - METHOD sums_and_counts. - DATA(lt_lines) = NEW lcl_report( )->select_data( - iv_from = '20260101' iv_to = '20260131' it_region = VALUE #( ) ). - cl_abap_unit_assert=>assert_equals( exp = 5 act = lines( lt_lines ) ). - cl_abap_unit_assert=>assert_equals( exp = '2' act = lt_lines[ 1 ]-farm_id ). - cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}milk-litres( 40 ) act = lt_lines[ 1 ]-litres ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_lines[ 1 ]-deliveries ). - ENDMETHOD. - - METHOD missing_delivery. - DATA(lt_lines) = NEW lcl_report( )->select_data( - iv_from = '20260101' iv_to = '20260131' it_region = VALUE #( ) ). - cl_abap_unit_assert=>assert_equals( exp = '4' act = lt_lines[ 5 ]-farm_id ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lt_lines[ 5 ]-deliveries ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lt_lines[ 5 ]-litres ). - ENDMETHOD. - - METHOD date_range. - DATA(lt_lines) = NEW lcl_report( )->select_data( - iv_from = '20260115' iv_to = '20260131' it_region = VALUE #( ) ). - cl_abap_unit_assert=>assert_equals( exp = 5 act = lines( lt_lines ) ). - cl_abap_unit_assert=>assert_equals( exp = '2' act = lt_lines[ 1 ]-farm_id ). - cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}milk-litres( 40 ) act = lt_lines[ 1 ]-litres ). - cl_abap_unit_assert=>assert_equals( exp = '1' act = lt_lines[ 3 ]-farm_id ). - cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}milk-litres( 5 ) act = lt_lines[ 3 ]-litres ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_lines[ 3 ]-deliveries ). - ENDMETHOD. - - METHOD tie_break. - DATA(lt_lines) = NEW lcl_report( )->select_data( - iv_from = '20260101' iv_to = '20260131' it_region = VALUE #( ) ). - cl_abap_unit_assert=>assert_equals( exp = '1' act = lt_lines[ 3 ]-farm_id ). - cl_abap_unit_assert=>assert_equals( exp = '5' act = lt_lines[ 4 ]-farm_id ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0124/seed/milk.tabl.asabap b/tasks_gen/eval/G0124/seed/milk.tabl.asabap deleted file mode 100644 index 2dc611f..0000000 --- a/tasks_gen/eval/G0124/seed/milk.tabl.asabap +++ /dev/null @@ -1,12 +0,0 @@ -@EndUserText.label : 'Milk delivery' -@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE -@AbapCatalog.tableCategory : #TRANSPARENT -@AbapCatalog.deliveryClass : #A -@AbapCatalog.dataMaintenance : #RESTRICTED -define table {{p}}milk { - key client : abap.clnt not null; - key deliv_id : abap.int4 not null; - farm_id : abap.char(10); - deliv_date : abap.dats; - litres : abap.dec(13,2); -} diff --git a/tasks_gen/eval/G0124/seed/farm.tabl.asabap b/tasks_gen/eval/G0124/seed/odom.tabl.asabap similarity index 51% rename from tasks_gen/eval/G0124/seed/farm.tabl.asabap rename to tasks_gen/eval/G0124/seed/odom.tabl.asabap index d5b8026..d84636e 100644 --- a/tasks_gen/eval/G0124/seed/farm.tabl.asabap +++ b/tasks_gen/eval/G0124/seed/odom.tabl.asabap @@ -1,11 +1,12 @@ -@EndUserText.label : 'Farm' +@EndUserText.label : 'Odometer readings' @AbapCatalog.enhancement.category : #NOT_EXTENSIBLE @AbapCatalog.tableCategory : #TRANSPARENT @AbapCatalog.deliveryClass : #A @AbapCatalog.dataMaintenance : #RESTRICTED -define table {{p}}farm { +define table {{p}}odom { key client : abap.clnt not null; - key farm_id : abap.char(10) not null; - farm_name : abap.char(40); - region : abap.char(4); + key read_id : abap.int4 not null; + veh_id : abap.char(10); + read_date : abap.dats; + odometer : abap.int4; } diff --git a/tasks_gen/eval/G0124/seed/seed_fleet.clas.abap b/tasks_gen/eval/G0124/seed/seed_fleet.clas.abap new file mode 100644 index 0000000..20408ff --- /dev/null +++ b/tasks_gen/eval/G0124/seed/seed_fleet.clas.abap @@ -0,0 +1,33 @@ +CLASS {{p}}seed_fleet DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES if_oo_adt_classrun. +ENDCLASS. + +CLASS {{p}}seed_fleet IMPLEMENTATION. + METHOD if_oo_adt_classrun~main. + DELETE FROM {{p}}odom. + DELETE FROM {{p}}veh. + INSERT {{p}}veh FROM TABLE @( VALUE #( + ( veh_id = 'V1' depot = 'D1' veh_type = 'TRUCK' ) + ( veh_id = 'V2' depot = 'D1' veh_type = 'VAN' ) + ( veh_id = 'V3' depot = 'D2' veh_type = 'TRUCK' ) + ( veh_id = 'V4' depot = 'D2' veh_type = 'VAN' ) ) ). + INSERT {{p}}odom FROM TABLE @( VALUE #( + ( read_id = 1 veh_id = 'V1' read_date = '20251220' odometer = 900 ) + ( read_id = 2 veh_id = 'V1' read_date = '20260101' odometer = 1000 ) + ( read_id = 3 veh_id = 'V1' read_date = '20260110' odometer = 1200 ) + ( read_id = 4 veh_id = 'V1' read_date = '20260120' odometer = 1500 ) + ( read_id = 5 veh_id = 'V2' read_date = '20260105' odometer = 500 ) + ( read_id = 6 veh_id = 'V2' read_date = '20260115' odometer = 700 ) + ( read_id = 7 veh_id = 'V3' read_date = '20260102' odometer = 5000 ) + ( read_id = 8 veh_id = 'V3' read_date = '20260112' odometer = 5300 ) + ( read_id = 9 veh_id = 'V3' read_date = '20260122' odometer = 5400 ) + ( read_id = 10 veh_id = 'V3' read_date = '20260125' odometer = 5600 ) + ( read_id = 11 veh_id = 'V4' read_date = '20260108' odometer = 300 ) + ( read_id = 12 veh_id = 'V9' read_date = '20260106' odometer = 100 ) + ( read_id = 13 veh_id = 'V9' read_date = '20260116' odometer = 400 ) + ( read_id = 14 veh_id = 'V9' read_date = '20260205' odometer = 700 ) + ( read_id = 15 veh_id = 'V9' read_date = '20260215' odometer = 1000 ) ) ). + out->write( sy-dbcnt ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0124/seed/t20_seed.clas.abap b/tasks_gen/eval/G0124/seed/t20_seed.clas.abap deleted file mode 100644 index de7a249..0000000 --- a/tasks_gen/eval/G0124/seed/t20_seed.clas.abap +++ /dev/null @@ -1,26 +0,0 @@ -CLASS {{p}}t20_seed DEFINITION PUBLIC FINAL CREATE PUBLIC. - PUBLIC SECTION. - INTERFACES if_oo_adt_classrun. -ENDCLASS. - -CLASS {{p}}t20_seed IMPLEMENTATION. - METHOD if_oo_adt_classrun~main. - DELETE FROM {{p}}milk. - DELETE FROM {{p}}farm. - INSERT {{p}}farm FROM TABLE @( VALUE #( - ( farm_id = '1000' farm_name = 'Alpine Dairy' region = 'CH' ) - ( farm_id = '1001' farm_name = 'Valley Farm' region = 'CH' ) - ( farm_id = '1002' farm_name = 'Lakeside Farm' region = 'DE' ) - ( farm_id = '1003' farm_name = 'Hilltop Farm' region = 'AT' ) - ( farm_id = '1004' farm_name = 'Sunny Acres' region = 'DE' ) ) ). - INSERT {{p}}milk FROM TABLE @( VALUE #( - ( deliv_id = 1 farm_id = '1000' deliv_date = '20260105' litres = '120.50' ) - ( deliv_id = 2 farm_id = '1000' deliv_date = '20260112' litres = '80.00' ) - ( deliv_id = 3 farm_id = '1001' deliv_date = '20260106' litres = '200.00' ) - ( deliv_id = 4 farm_id = '1002' deliv_date = '20260107' litres = '50.25' ) - ( deliv_id = 5 farm_id = '1003' deliv_date = '20251220' litres = '300.00' ) - ( deliv_id = 6 farm_id = '1001' deliv_date = '20260215' litres = '40.00' ) - ( deliv_id = 7 farm_id = '1004' deliv_date = '20260108' litres = '50.25' ) ) ). - out->write( sy-dbcnt ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0124/seed/veh.tabl.asabap b/tasks_gen/eval/G0124/seed/veh.tabl.asabap new file mode 100644 index 0000000..af22cd6 --- /dev/null +++ b/tasks_gen/eval/G0124/seed/veh.tabl.asabap @@ -0,0 +1,11 @@ +@EndUserText.label : 'Vehicle master' +@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE +@AbapCatalog.tableCategory : #TRANSPARENT +@AbapCatalog.deliveryClass : #A +@AbapCatalog.dataMaintenance : #RESTRICTED +define table {{p}}veh { + key client : abap.clnt not null; + key veh_id : abap.char(10) not null; + depot : abap.char(4); + veh_type : abap.char(10); +} diff --git a/tasks_gen/eval/G0124/spec.md b/tasks_gen/eval/G0124/spec.md index 8adaffc..0550eef 100644 --- a/tasks_gen/eval/G0124/spec.md +++ b/tasks_gen/eval/G0124/spec.md @@ -1,45 +1,51 @@ # 1. Goal -Show the milk deliveries of each farm in an ALV list. The cooperative uses the -list to compare the farms of a region for a period. +A facility management company operates a fleet of vehicles. The fleet manager +needs a report that shows the distance that each vehicle drove in a period. +The fleet manager uses the report to compare the vehicles. # 2. Open questions None. # 3. Context -- Table {{P}}FARM exists in package $TMP. It contains data. - Fields: FARM_ID (CHAR 10, key), FARM_NAME (CHAR 40), REGION (CHAR 4). -- Table {{P}}MILK exists in package $TMP. It contains data. - Fields: DELIV_ID (INT4, key), FARM_ID (CHAR 10), DELIV_DATE (DATS), - LITRES (DEC 13,2). +The tables {{P}}VEH and {{P}}ODOM exist in package $TMP. Both tables contain +data. + +Table {{P}}VEH holds the vehicles. +Fields: VEH_ID (CHAR 10, key), DEPOT (CHAR 4), VEH_TYPE (CHAR 10). + +Table {{P}}ODOM holds the odometer readings of the vehicles. +Fields: READ_ID (INT4, key), VEH_ID (CHAR 10), READ_DATE (DATS), +ODOMETER (INT4, the odometer value in kilometres). + +A vehicle can have many odometer readings. An odometer reading can belong to a +vehicle that is not in {{P}}VEH. # 4. Contract -- Create the executable program {{P}}MILK_SUM in package $TMP. +- Create the executable program {{P}}FLEET_DIST in package $TMP. - Selection screen: - - Parameter P_FROM, type DATS, mandatory: the first delivery date to include. - - Parameter P_TO, type DATS, mandatory: the last delivery date to include. - - Select-option S_REG for the region. + - Parameter P_FROM, type DATS, mandatory: the first reading date to include. + - Parameter P_TO, type DATS, mandatory: the last reading date to include. + - Select-option S_DEPOT for the depot. - Show the result with CL_SALV_TABLE. The output table has these columns, with - these names: FARM_ID, FARM_NAME, REGION, LITRES, DELIVERIES. +these names: VEH_ID, DEPOT, DISTANCE, READINGS. # 5. Business rules -1. Include a delivery only if DELIV_DATE is on or after P_FROM and on or before - P_TO. Both limits are included. -2. Include a farm only if REGION is in S_REG. An empty S_REG includes every - region. A line with sign E in S_REG excludes its region. -3. Show one line for each included farm. A farm without an included delivery also - gets a line. -4. LITRES is the sum of the litres of the included deliveries of the farm. LITRES - is 0 if the farm has no included delivery. -5. DELIVERIES is the number of included deliveries of the farm. DELIVERIES is 0 - if the farm has no included delivery. -6. Sort the lines by LITRES, the highest value first. If two lines have the same - LITRES, sort them by FARM_ID, the lowest value first. -7. FARM_NAME and REGION are the values of the farm. +1. Include an odometer reading only if READ_DATE is on or after P_FROM and on + or before P_TO. +2. Include a vehicle only if the vehicle is in {{P}}VEH and its DEPOT is in + S_DEPOT. +3. Include a vehicle only if at least two of its readings are included. +4. DISTANCE is the highest included ODOMETER value of the vehicle minus the + lowest included ODOMETER value of the vehicle. +5. READINGS is the number of included readings of the vehicle. +6. Show one line for each included vehicle. +7. Sort the lines by DISTANCE. The highest distance comes first. If two lines + have the same DISTANCE, the line with the smaller VEH_ID comes first. # 6. Constraints -- Release target: 7.58. -- Coding standards: Clean ABAP. Read each table with one database access. -- Out of scope: do not change {{P}}FARM and {{P}}MILK. +- Release target: 8.16. +- Coding standards: Clean ABAP. +- Out of scope: do not change {{P}}VEH and {{P}}ODOM. # 7. Acceptance - The program is active and has no syntax error. diff --git a/tasks_gen/eval/G0124/task.json b/tasks_gen/eval/G0124/task.json index 77aeed7..ea5f7aa 100644 --- a/tasks_gen/eval/G0124/task.json +++ b/tasks_gen/eval/G0124/task.json @@ -3,7 +3,7 @@ "category": "C", "object_type": "PROG", "difficulty": 2, - "release_target": "v758", + "release_target": "v816", "expected_outcome": "implement", "budget": { "max_tool_calls": 60, @@ -12,56 +12,57 @@ "seed": [ { "type": "TABL", - "name": "{{P}}FARM", - "file": "seed/farm.tabl.asabap", - "description": "Farms of the cooperative" + "name": "{{P}}VEH", + "file": "seed/veh.tabl.asabap", + "description": "Vehicle master" }, { "type": "TABL", - "name": "{{P}}MILK", - "file": "seed/milk.tabl.asabap", - "description": "Milk deliveries" + "name": "{{P}}ODOM", + "file": "seed/odom.tabl.asabap", + "description": "Odometer readings" }, { "type": "CLAS", - "name": "{{P}}T20_SEED", - "file": "seed/t20_seed.clas.abap", - "description": "T20 seed data", + "name": "{{P}}SEED_FLEET", + "file": "seed/seed_fleet.clas.abap", + "description": "Fleet seed data", "run": true } ], "contract": [ { "type": "PROG", - "name": "{{P}}MILK_SUM", + "name": "{{P}}FLEET_DIST", "parameters": [ "p_from", "p_to", - "s_reg" + "s_depot" ] } ], "out_of_scope": [ - "{{P}}FARM", - "{{P}}MILK" + "{{P}}VEH", + "{{P}}ODOM" ], "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}T20_HIDDEN", - "file": "hidden/t20_hidden.clas.abap", - "description": "T20 hidden tests" + "name": "{{P}}FLEET_HIDDEN", + "file": "hidden/fleet_hidden.clas.abap", + "description": "Fleet distance hidden tests" } ], "reference": [ { "type": "PROG", - "name": "{{P}}MILK_SUM", - "file": "reference/milk_sum.prog.abap", - "description": "Milk litres per farm" + "name": "{{P}}FLEET_DIST", + "file": "reference/fleet_dist.prog.abap", + "description": "Fleet distance per vehicle" } ], "craft_checks": [ + "internal_table_key", "db_operation_in_loop", "method_length" ] diff --git a/tasks_gen/eval/G0125/empirical.json b/tasks_gen/eval/G0125/empirical.json new file mode 100644 index 0000000..e217ee8 --- /dev/null +++ b/tasks_gen/eval/G0125/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 90.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 0.0, + "total": 90.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "8/8", + "tool_calls": 47, + "seconds": 949.8, + "run_dir": "runs/emp/11010_G0125_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0125/review.json b/tasks_gen/eval/G0125/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0125/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0126/empirical.json b/tasks_gen/eval/G0126/empirical.json new file mode 100644 index 0000000..8334059 --- /dev/null +++ b/tasks_gen/eval/G0126/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 93.5, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 13.5, + "own_tests": 15.0, + "discipline": 5.0, + "total": 93.5, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 37, + "seconds": 244.9, + "run_dir": "runs/emp/11011_G0126_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0126/review.json b/tasks_gen/eval/G0126/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0126/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0127/empirical.json b/tasks_gen/eval/G0127/empirical.json new file mode 100644 index 0000000..1cee066 --- /dev/null +++ b/tasks_gen/eval/G0127/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 98.5, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 13.5, + "own_tests": 15.0, + "discipline": 10.0, + "total": 98.5, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "12/12", + "tool_calls": 14, + "seconds": 103.2, + "run_dir": "runs/emp/10042_G0127_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0127/review.json b/tasks_gen/eval/G0127/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0127/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0128/empirical.json b/tasks_gen/eval/G0128/empirical.json new file mode 100644 index 0000000..236aeb9 --- /dev/null +++ b/tasks_gen/eval/G0128/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 29, + "seconds": 91.2, + "run_dir": "runs/emp/10043_G0128_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0128/review.json b/tasks_gen/eval/G0128/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0128/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0129/faulty/m0_cold_chain_check.clas.abap b/tasks_gen/eval/G0129/faulty/m0_cold_chain_check.clas.abap new file mode 100644 index 0000000..16fe636 --- /dev/null +++ b/tasks_gen/eval/G0129/faulty/m0_cold_chain_check.clas.abap @@ -0,0 +1,151 @@ +CLASS {{p}}cold_chain_check DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES: BEGIN OF ty_reading, + offset_min TYPE i, + temp_tenths TYPE i, + END OF ty_reading, + tt_readings TYPE STANDARD TABLE OF ty_reading WITH EMPTY KEY, + BEGIN OF ty_config, + min_tenths TYPE i, + max_tenths TYPE i, + min_duration TYPE i, + max_gap TYPE i, + END OF ty_config. + + METHODS constructor + IMPORTING is_config TYPE ty_config. + + METHODS check + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i + RAISING {{p}}cx_cold_chain. + + PRIVATE SECTION. + DATA ms_config TYPE ty_config. + + METHODS first_violation + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_structure + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_duration + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_gap + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_temperatures + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS mean_tenths + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i. +ENDCLASS. + + +CLASS {{p}}cold_chain_check IMPLEMENTATION. + METHOD constructor. + ms_config = is_config. + ENDMETHOD. + + METHOD check. + DATA(lv_rule) = first_violation( it_readings ). + IF lv_rule IS NOT INITIAL. + RAISE EXCEPTION TYPE {{p}}cx_cold_chain + EXPORTING + iv_rule = lv_rule. + ENDIF. + rv_mean = mean_tenths( it_readings ). + ENDMETHOD. + + METHOD first_violation. + rv_rule = check_structure( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_duration( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_gap( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_temperatures( it_readings ). + ENDMETHOD. + + METHOD check_structure. + IF lines( it_readings ) < 2. + rv_rule = 'TOO_FEW'. + RETURN. + ENDIF. + READ TABLE it_readings INDEX 1 INTO DATA(ls_first). + IF ls_first-offset_min = 0. + rv_rule = 'NO_START'. + RETURN. + ENDIF. + DATA(lv_previous) = ls_first-offset_min. + LOOP AT it_readings FROM 2 INTO DATA(ls_reading). + IF ls_reading-offset_min <= lv_previous. + rv_rule = 'TIME_ORDER'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_duration. + DATA lv_last TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_last = ls_reading-offset_min. + ENDLOOP. + IF lv_last < ms_config-min_duration. + rv_rule = 'TOO_SHORT'. + ENDIF. + ENDMETHOD. + + METHOD check_gap. + DATA lv_previous TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + IF sy-tabix > 1 AND ls_reading-offset_min - lv_previous > ms_config-max_gap. + rv_rule = 'GAP'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_temperatures. + LOOP AT it_readings INTO DATA(ls_reading). + IF ls_reading-temp_tenths > ms_config-max_tenths. + rv_rule = 'TOO_HIGH'. + RETURN. + ENDIF. + IF ls_reading-temp_tenths < ms_config-min_tenths. + rv_rule = 'TOO_LOW'. + RETURN. + ENDIF. + ENDLOOP. + ENDMETHOD. + + METHOD mean_tenths. + DATA lv_sum TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_sum = lv_sum + ls_reading-temp_tenths. + ENDLOOP. + DATA(lv_count) = lines( it_readings ). + IF lv_count = 0. + rv_mean = 0. + RETURN. + ENDIF. + DATA(lv_abs_sum) = lv_sum. + IF lv_abs_sum < 0. + lv_abs_sum = -1 * lv_abs_sum. + ENDIF. + rv_mean = lv_abs_sum DIV lv_count. + IF lv_sum < 0. + rv_mean = -1 * rv_mean. + ENDIF. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0129/faulty/m1_cold_chain_check.clas.abap b/tasks_gen/eval/G0129/faulty/m1_cold_chain_check.clas.abap new file mode 100644 index 0000000..3945958 --- /dev/null +++ b/tasks_gen/eval/G0129/faulty/m1_cold_chain_check.clas.abap @@ -0,0 +1,151 @@ +CLASS {{p}}cold_chain_check DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES: BEGIN OF ty_reading, + offset_min TYPE i, + temp_tenths TYPE i, + END OF ty_reading, + tt_readings TYPE STANDARD TABLE OF ty_reading WITH EMPTY KEY, + BEGIN OF ty_config, + min_tenths TYPE i, + max_tenths TYPE i, + min_duration TYPE i, + max_gap TYPE i, + END OF ty_config. + + METHODS constructor + IMPORTING is_config TYPE ty_config. + + METHODS check + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i + RAISING {{p}}cx_cold_chain. + + PRIVATE SECTION. + DATA ms_config TYPE ty_config. + + METHODS first_violation + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_structure + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_duration + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_gap + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_temperatures + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS mean_tenths + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i. +ENDCLASS. + + +CLASS {{p}}cold_chain_check IMPLEMENTATION. + METHOD constructor. + ms_config = is_config. + ENDMETHOD. + + METHOD check. + DATA(lv_rule) = first_violation( it_readings ). + IF lv_rule IS NOT INITIAL. + RAISE EXCEPTION TYPE {{p}}cx_cold_chain + EXPORTING + iv_rule = lv_rule. + ENDIF. + rv_mean = mean_tenths( it_readings ). + ENDMETHOD. + + METHOD first_violation. + rv_rule = check_structure( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_duration( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_gap( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_temperatures( it_readings ). + ENDMETHOD. + + METHOD check_structure. + IF lines( it_readings ) < 2. + rv_rule = 'TOO_FEW'. + RETURN. + ENDIF. + READ TABLE it_readings INDEX 1 INTO DATA(ls_first). + IF ls_first-offset_min <> 0. + rv_rule = 'NO_START'. + RETURN. + ENDIF. + DATA(lv_previous) = ls_first-offset_min. + LOOP AT it_readings FROM 3 INTO DATA(ls_reading). + IF ls_reading-offset_min <= lv_previous. + rv_rule = 'TIME_ORDER'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_duration. + DATA lv_last TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_last = ls_reading-offset_min. + ENDLOOP. + IF lv_last < ms_config-min_duration. + rv_rule = 'TOO_SHORT'. + ENDIF. + ENDMETHOD. + + METHOD check_gap. + DATA lv_previous TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + IF sy-tabix > 1 AND ls_reading-offset_min - lv_previous > ms_config-max_gap. + rv_rule = 'GAP'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_temperatures. + LOOP AT it_readings INTO DATA(ls_reading). + IF ls_reading-temp_tenths > ms_config-max_tenths. + rv_rule = 'TOO_HIGH'. + RETURN. + ENDIF. + IF ls_reading-temp_tenths < ms_config-min_tenths. + rv_rule = 'TOO_LOW'. + RETURN. + ENDIF. + ENDLOOP. + ENDMETHOD. + + METHOD mean_tenths. + DATA lv_sum TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_sum = lv_sum + ls_reading-temp_tenths. + ENDLOOP. + DATA(lv_count) = lines( it_readings ). + IF lv_count = 0. + rv_mean = 0. + RETURN. + ENDIF. + DATA(lv_abs_sum) = lv_sum. + IF lv_abs_sum < 0. + lv_abs_sum = -1 * lv_abs_sum. + ENDIF. + rv_mean = lv_abs_sum DIV lv_count. + IF lv_sum < 0. + rv_mean = -1 * rv_mean. + ENDIF. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0129/faulty/m2_cold_chain_check.clas.abap b/tasks_gen/eval/G0129/faulty/m2_cold_chain_check.clas.abap new file mode 100644 index 0000000..d78006b --- /dev/null +++ b/tasks_gen/eval/G0129/faulty/m2_cold_chain_check.clas.abap @@ -0,0 +1,151 @@ +CLASS {{p}}cold_chain_check DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES: BEGIN OF ty_reading, + offset_min TYPE i, + temp_tenths TYPE i, + END OF ty_reading, + tt_readings TYPE STANDARD TABLE OF ty_reading WITH EMPTY KEY, + BEGIN OF ty_config, + min_tenths TYPE i, + max_tenths TYPE i, + min_duration TYPE i, + max_gap TYPE i, + END OF ty_config. + + METHODS constructor + IMPORTING is_config TYPE ty_config. + + METHODS check + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i + RAISING {{p}}cx_cold_chain. + + PRIVATE SECTION. + DATA ms_config TYPE ty_config. + + METHODS first_violation + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_structure + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_duration + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_gap + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_temperatures + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS mean_tenths + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i. +ENDCLASS. + + +CLASS {{p}}cold_chain_check IMPLEMENTATION. + METHOD constructor. + ms_config = is_config. + ENDMETHOD. + + METHOD check. + DATA(lv_rule) = first_violation( it_readings ). + IF lv_rule IS NOT INITIAL. + RAISE EXCEPTION TYPE {{p}}cx_cold_chain + EXPORTING + iv_rule = lv_rule. + ENDIF. + rv_mean = mean_tenths( it_readings ). + ENDMETHOD. + + METHOD first_violation. + rv_rule = check_structure( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_duration( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_gap( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_temperatures( it_readings ). + ENDMETHOD. + + METHOD check_structure. + IF lines( it_readings ) < 2. + rv_rule = 'TOO_FEW'. + RETURN. + ENDIF. + READ TABLE it_readings INDEX 1 INTO DATA(ls_first). + IF ls_first-offset_min <> 0. + rv_rule = 'NO_START'. + RETURN. + ENDIF. + DATA(lv_previous) = ls_first-offset_min. + LOOP AT it_readings FROM 2 INTO DATA(ls_reading). + IF ls_reading-offset_min <= lv_previous. + rv_rule = 'TIME_ORDER'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_duration. + DATA lv_last TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_last = ls_reading-offset_min. + ENDLOOP. + IF lv_last < ms_config-min_duration. + rv_rule = 'TOO_SHORT'. + ENDIF. + ENDMETHOD. + + METHOD check_gap. + DATA lv_previous TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + IF sy-tabix > 1 AND ls_reading-offset_min - lv_previous > ms_config-max_gap. + rv_rule = 'GAP'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_temperatures. + LOOP AT it_readings INTO DATA(ls_reading). + IF ls_reading-temp_tenths > ms_config-max_tenths. + rv_rule = 'TOO_HIGH'. + RETURN. + ENDIF. + IF ls_reading-temp_tenths < ms_config-min_tenths. + rv_rule = 'TOO_LOW'. + RETURN. + ENDIF. + ENDLOOP. + ENDMETHOD. + + METHOD mean_tenths. + DATA lv_sum TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_sum = lv_sum + ls_reading-temp_tenths. + ENDLOOP. + DATA(lv_count) = lines( it_readings ). + IF lv_count <> 0. + rv_mean = 0. + RETURN. + ENDIF. + DATA(lv_abs_sum) = lv_sum. + IF lv_abs_sum < 0. + lv_abs_sum = -1 * lv_abs_sum. + ENDIF. + rv_mean = lv_abs_sum DIV lv_count. + IF lv_sum < 0. + rv_mean = -1 * rv_mean. + ENDIF. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0129/faulty/m3_cold_chain_check.clas.abap b/tasks_gen/eval/G0129/faulty/m3_cold_chain_check.clas.abap new file mode 100644 index 0000000..f42ff5a --- /dev/null +++ b/tasks_gen/eval/G0129/faulty/m3_cold_chain_check.clas.abap @@ -0,0 +1,151 @@ +CLASS {{p}}cold_chain_check DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES: BEGIN OF ty_reading, + offset_min TYPE i, + temp_tenths TYPE i, + END OF ty_reading, + tt_readings TYPE STANDARD TABLE OF ty_reading WITH EMPTY KEY, + BEGIN OF ty_config, + min_tenths TYPE i, + max_tenths TYPE i, + min_duration TYPE i, + max_gap TYPE i, + END OF ty_config. + + METHODS constructor + IMPORTING is_config TYPE ty_config. + + METHODS check + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i + RAISING {{p}}cx_cold_chain. + + PRIVATE SECTION. + DATA ms_config TYPE ty_config. + + METHODS first_violation + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_structure + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_duration + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_gap + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_temperatures + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS mean_tenths + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i. +ENDCLASS. + + +CLASS {{p}}cold_chain_check IMPLEMENTATION. + METHOD constructor. + ms_config = is_config. + ENDMETHOD. + + METHOD check. + DATA(lv_rule) = first_violation( it_readings ). + IF lv_rule IS NOT INITIAL. + RAISE EXCEPTION TYPE {{p}}cx_cold_chain + EXPORTING + iv_rule = lv_rule. + ENDIF. + rv_mean = mean_tenths( it_readings ). + ENDMETHOD. + + METHOD first_violation. + rv_rule = check_structure( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_duration( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_gap( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_temperatures( it_readings ). + ENDMETHOD. + + METHOD check_structure. + IF lines( it_readings ) < 2. + rv_rule = 'TOO_FEW'. + RETURN. + ENDIF. + READ TABLE it_readings INDEX 1 INTO DATA(ls_first). + IF ls_first-offset_min <> 0. + rv_rule = 'NO_START'. + RETURN. + ENDIF. + DATA(lv_previous) = ls_first-offset_min. + LOOP AT it_readings FROM 2 INTO DATA(ls_reading). + IF ls_reading-offset_min <= lv_previous. + rv_rule = 'TIME_ORDER'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_duration. + DATA lv_last TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_last = ls_reading-offset_min. + ENDLOOP. + IF lv_last < ms_config-min_duration. + rv_rule = 'TOO_SHORT'. + ENDIF. + ENDMETHOD. + + METHOD check_gap. + DATA lv_previous TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + IF sy-tabix > 1 AND ls_reading-offset_min - lv_previous > ms_config-max_gap. + rv_rule = 'GAP'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_temperatures. + LOOP AT it_readings INTO DATA(ls_reading). + IF ls_reading-temp_tenths > ms_config-max_tenths. + rv_rule = 'TOO_HIGH'. + RETURN. + ENDIF. + IF ls_reading-temp_tenths < ms_config-min_tenths. + rv_rule = 'TOO_LOW'. + RETURN. + ENDIF. + ENDLOOP. + ENDMETHOD. + + METHOD mean_tenths. + DATA lv_sum TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_sum = lv_sum + ls_reading-temp_tenths. + ENDLOOP. + DATA(lv_count) = lines( it_readings ). + IF lv_count = 0. + rv_mean = 0. + RETURN. + ENDIF. + DATA(lv_abs_sum) = lv_sum. + IF lv_abs_sum < 0. + lv_abs_sum = -1 / lv_abs_sum. + ENDIF. + rv_mean = lv_abs_sum DIV lv_count. + IF lv_sum < 0. + rv_mean = -1 * rv_mean. + ENDIF. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0129/faulty/m4_cold_chain_check.clas.abap b/tasks_gen/eval/G0129/faulty/m4_cold_chain_check.clas.abap new file mode 100644 index 0000000..148e652 --- /dev/null +++ b/tasks_gen/eval/G0129/faulty/m4_cold_chain_check.clas.abap @@ -0,0 +1,151 @@ +CLASS {{p}}cold_chain_check DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES: BEGIN OF ty_reading, + offset_min TYPE i, + temp_tenths TYPE i, + END OF ty_reading, + tt_readings TYPE STANDARD TABLE OF ty_reading WITH EMPTY KEY, + BEGIN OF ty_config, + min_tenths TYPE i, + max_tenths TYPE i, + min_duration TYPE i, + max_gap TYPE i, + END OF ty_config. + + METHODS constructor + IMPORTING is_config TYPE ty_config. + + METHODS check + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i + RAISING {{p}}cx_cold_chain. + + PRIVATE SECTION. + DATA ms_config TYPE ty_config. + + METHODS first_violation + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_structure + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_duration + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_gap + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_temperatures + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS mean_tenths + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i. +ENDCLASS. + + +CLASS {{p}}cold_chain_check IMPLEMENTATION. + METHOD constructor. + ms_config = is_config. + ENDMETHOD. + + METHOD check. + DATA(lv_rule) = first_violation( it_readings ). + IF lv_rule IS NOT INITIAL. + RAISE EXCEPTION TYPE {{p}}cx_cold_chain + EXPORTING + iv_rule = lv_rule. + ENDIF. + rv_mean = mean_tenths( it_readings ). + ENDMETHOD. + + METHOD first_violation. + rv_rule = check_structure( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_duration( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_gap( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_temperatures( it_readings ). + ENDMETHOD. + + METHOD check_structure. + IF lines( it_readings ) < 2. + rv_rule = 'TOO_FEW'. + RETURN. + ENDIF. + READ TABLE it_readings INDEX 1 INTO DATA(ls_first). + IF ls_first-offset_min <> 0. + rv_rule = 'NO_START'. + RETURN. + ENDIF. + DATA(lv_previous) = ls_first-offset_min. + LOOP AT it_readings FROM 2 INTO DATA(ls_reading). + IF ls_reading-offset_min <= lv_previous. + rv_rule = 'TIME_ORDER'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_duration. + DATA lv_last TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_last = ls_reading-offset_min. + ENDLOOP. + IF lv_last < ms_config-min_duration. + rv_rule = 'TOO_SHORT'. + ENDIF. + ENDMETHOD. + + METHOD check_gap. + DATA lv_previous TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + IF sy-tabix > 1 AND ls_reading-offset_min - lv_previous > ms_config-max_gap. + rv_rule = 'GAP'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_temperatures. + LOOP AT it_readings INTO DATA(ls_reading). + IF ls_reading-temp_tenths > ms_config-max_tenths. + rv_rule = 'TOO_HIGH'. + RETURN. + ENDIF. + IF ls_reading-temp_tenths < ms_config-min_tenths. + rv_rule = 'TOO_LOW'. + RETURN. + ENDIF. + ENDLOOP. + ENDMETHOD. + + METHOD mean_tenths. + DATA lv_sum TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_sum = lv_sum + ls_reading-temp_tenths. + ENDLOOP. + DATA(lv_count) = lines( it_readings ). + IF lv_count = 0. + rv_mean = 0. + RETURN. + ENDIF. + DATA(lv_abs_sum) = lv_sum. + IF lv_abs_sum < 0. + lv_abs_sum = -1 * lv_abs_sum. + ENDIF. + rv_mean = lv_abs_sum DIV lv_count. + IF lv_sum < 0. + rv_mean = -1 / rv_mean. + ENDIF. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0129/generation.json b/tasks_gen/eval/G0129/generation.json new file mode 100644 index 0000000..9b5d91d --- /dev/null +++ b/tasks_gen/eval/G0129/generation.json @@ -0,0 +1,29 @@ +{ + "id": "G0129", + "pool": "eval", + "object_type": "CLAS", + "category": "D", + "attempts": [ + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 100.0, + "null": 0, + "mutation": { + "valid": 5, + "killed": 5, + "ok": true + } + } + ], + "accepted": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0129/hidden/cold_chain_hidden.clas.abap b/tasks_gen/eval/G0129/hidden/cold_chain_hidden.clas.abap new file mode 100644 index 0000000..4b390b9 --- /dev/null +++ b/tasks_gen/eval/G0129/hidden/cold_chain_hidden.clas.abap @@ -0,0 +1,149 @@ +CLASS {{p}}cold_chain_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + DATA mo_cut TYPE REF TO {{p}}cold_chain_check. + + METHODS setup. + METHODS build + IMPORTING iv_offsets TYPE string + iv_temps TYPE string + RETURNING VALUE(rt_readings) TYPE {{p}}cold_chain_check=>tt_readings. + METHODS mean_of + IMPORTING it_readings TYPE {{p}}cold_chain_check=>tt_readings + RETURNING VALUE(rv_mean) TYPE i. + METHODS rule_of + IMPORTING it_readings TYPE {{p}}cold_chain_check=>tt_readings + RETURNING VALUE(rv_rule) TYPE string. + + METHODS valid_log_returns_mean FOR TESTING. + METHODS too_few_readings FOR TESTING. + METHODS no_start_at_zero FOR TESTING. + METHODS offsets_not_increasing FOR TESTING. + METHODS duration_too_short FOR TESTING. + METHODS gap_too_large FOR TESTING. + METHODS temperature_too_high FOR TESTING. + METHODS temperature_too_low FOR TESTING. + METHODS structural_error_first FOR TESTING. + METHODS negative_mean_truncated FOR TESTING. + METHODS exception_text FOR TESTING. +ENDCLASS. + + +CLASS {{p}}cold_chain_hidden IMPLEMENTATION. + METHOD setup. + mo_cut = NEW {{p}}cold_chain_check( + is_config = VALUE #( min_tenths = 20 + max_tenths = 80 + min_duration = 120 + max_gap = 60 ) ). + ENDMETHOD. + + METHOD build. + DATA lt_offsets TYPE STANDARD TABLE OF string WITH EMPTY KEY. + DATA lt_temps TYPE STANDARD TABLE OF string WITH EMPTY KEY. + SPLIT iv_offsets AT `,` INTO TABLE lt_offsets. + SPLIT iv_temps AT `,` INTO TABLE lt_temps. + DATA(lv_count) = lines( lt_offsets ). + DO lv_count TIMES. + APPEND VALUE #( offset_min = CONV i( lt_offsets[ sy-index ] ) + temp_tenths = CONV i( lt_temps[ sy-index ] ) ) TO rt_readings. + ENDDO. + ENDMETHOD. + + METHOD mean_of. + TRY. + rv_mean = mo_cut->check( it_readings ). + CATCH {{p}}cx_cold_chain INTO DATA(lx_error). + cl_abap_unit_assert=>fail( |Unexpected exception: { lx_error->mv_rule }| ). + ENDTRY. + ENDMETHOD. + + METHOD rule_of. + TRY. + mo_cut->check( it_readings ). + cl_abap_unit_assert=>fail( `Exception expected` ). + CATCH {{p}}cx_cold_chain INTO DATA(lx_error). + rv_rule = lx_error->mv_rule. + ENDTRY. + ENDMETHOD. + + METHOD valid_log_returns_mean. + cl_abap_unit_assert=>assert_equals( + exp = 47 + act = mean_of( build( iv_offsets = `0,30,60,120` iv_temps = `40,45,50,55` ) ) ). + ENDMETHOD. + + METHOD too_few_readings. + cl_abap_unit_assert=>assert_equals( + exp = 'TOO_FEW' + act = rule_of( build( iv_offsets = `0` iv_temps = `40` ) ) ). + ENDMETHOD. + + METHOD no_start_at_zero. + cl_abap_unit_assert=>assert_equals( + exp = 'NO_START' + act = rule_of( build( iv_offsets = `10,30,60,120` iv_temps = `40,45,50,55` ) ) ). + ENDMETHOD. + + METHOD offsets_not_increasing. + cl_abap_unit_assert=>assert_equals( + exp = 'TIME_ORDER' + act = rule_of( build( iv_offsets = `0,30,30,120` iv_temps = `40,45,50,55` ) ) ). + ENDMETHOD. + + METHOD duration_too_short. + cl_abap_unit_assert=>assert_equals( + exp = 'TOO_SHORT' + act = rule_of( build( iv_offsets = `0,30,60,90` iv_temps = `40,45,50,55` ) ) ). + ENDMETHOD. + + METHOD gap_too_large. + cl_abap_unit_assert=>assert_equals( + exp = 'GAP' + act = rule_of( build( iv_offsets = `0,90,120` iv_temps = `40,45,50` ) ) ). + ENDMETHOD. + + METHOD temperature_too_high. + cl_abap_unit_assert=>assert_equals( + exp = 'TOO_HIGH' + act = rule_of( build( iv_offsets = `0,30,60,120` iv_temps = `40,45,85,55` ) ) ). + ENDMETHOD. + + METHOD temperature_too_low. + cl_abap_unit_assert=>assert_equals( + exp = 'TOO_LOW' + act = rule_of( build( iv_offsets = `0,30,60,120` iv_temps = `40,45,15,55` ) ) ). + ENDMETHOD. + + METHOD structural_error_first. + cl_abap_unit_assert=>assert_equals( + exp = 'NO_START' + act = rule_of( build( iv_offsets = `10,30,60,90` iv_temps = `40,45,85,55` ) ) ). + ENDMETHOD. + + METHOD negative_mean_truncated. + DATA(lo_cut) = NEW {{p}}cold_chain_check( + is_config = VALUE #( min_tenths = -250 + max_tenths = -150 + min_duration = 60 + max_gap = 60 ) ). + DATA lv_mean TYPE i. + TRY. + lv_mean = lo_cut->check( build( iv_offsets = `0,60` iv_temps = `-200,-211` ) ). + CATCH {{p}}cx_cold_chain INTO DATA(lx_error). + cl_abap_unit_assert=>fail( |Unexpected exception: { lx_error->mv_rule }| ). + ENDTRY. + cl_abap_unit_assert=>assert_equals( exp = -205 act = lv_mean ). + ENDMETHOD. + + METHOD exception_text. + TRY. + mo_cut->check( build( iv_offsets = `` iv_temps = `` ) ). + cl_abap_unit_assert=>fail( `Exception expected` ). + CATCH {{p}}cx_cold_chain INTO DATA(lx_error). + cl_abap_unit_assert=>assert_equals( + exp = `Cold chain check failed: TOO_FEW` + act = lx_error->get_text( ) ). + ENDTRY. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0129/hidden/t_print_hidden.clas.abap b/tasks_gen/eval/G0129/hidden/t_print_hidden.clas.abap deleted file mode 100644 index 436c5d1..0000000 --- a/tasks_gen/eval/G0129/hidden/t_print_hidden.clas.abap +++ /dev/null @@ -1,267 +0,0 @@ -CLASS {{p}}t_print_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - METHODS a4_mono_price FOR TESTING. - METHODS a4_color_price FOR TESTING. - METHODS a3_a5_price FOR TESTING. - METHODS volume_discount_5 FOR TESTING. - METHODS volume_discount_10 FOR TESTING. - METHODS minimum_charge FOR TESTING. - METHODS copies_multiply FOR TESTING. - METHODS rejects_zero_pages FOR TESTING. - METHODS rejects_zero_copies FOR TESTING. - METHODS rejects_unknown_values FOR TESTING. - METHODS rejects_over_limit FOR TESTING. - METHODS first_error_wins FOR TESTING. -ENDCLASS. - - -CLASS {{p}}t_print_hidden IMPLEMENTATION. - METHOD a4_mono_price. - DATA lv_cents TYPE i. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - DATA(lv_price) = lo_cut->calculate_price( iv_pages = 100 - iv_copies = 1 - iv_paper = 'A4' - iv_color = 'M' - iv_dept = 'SALE' ). - lv_cents = lv_price * 100. - cl_abap_unit_assert=>assert_equals( exp = 500 act = lv_cents ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - ENDMETHOD. - - METHOD a4_color_price. - DATA lv_cents TYPE i. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - DATA(lv_price) = lo_cut->calculate_price( iv_pages = 100 - iv_copies = 1 - iv_paper = 'A4' - iv_color = 'C' - iv_dept = 'SALE' ). - lv_cents = lv_price * 100. - cl_abap_unit_assert=>assert_equals( exp = 2000 act = lv_cents ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - ENDMETHOD. - - METHOD a3_a5_price. - DATA lv_cents TYPE i. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - DATA(lv_price) = lo_cut->calculate_price( iv_pages = 100 - iv_copies = 1 - iv_paper = 'A3' - iv_color = 'M' - iv_dept = 'PROD' ). - lv_cents = lv_price * 100. - cl_abap_unit_assert=>assert_equals( exp = 900 act = lv_cents ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - TRY. - DATA(lv_a5) = lo_cut->calculate_price( iv_pages = 100 - iv_copies = 1 - iv_paper = 'A5' - iv_color = 'M' - iv_dept = 'HR' ). - lv_cents = lv_a5 * 100. - cl_abap_unit_assert=>assert_equals( exp = 300 act = lv_cents ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - ENDMETHOD. - - METHOD volume_discount_5. - DATA lv_cents TYPE i. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - DATA(lv_price) = lo_cut->calculate_price( iv_pages = 600 - iv_copies = 1 - iv_paper = 'A4' - iv_color = 'M' - iv_dept = 'IT' ). - lv_cents = lv_price * 100. - cl_abap_unit_assert=>assert_equals( exp = 2850 act = lv_cents ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - TRY. - DATA(lv_500) = lo_cut->calculate_price( iv_pages = 500 - iv_copies = 1 - iv_paper = 'A4' - iv_color = 'M' - iv_dept = 'IT' ). - lv_cents = lv_500 * 100. - cl_abap_unit_assert=>assert_equals( exp = 2375 act = lv_cents ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - ENDMETHOD. - - METHOD volume_discount_10. - DATA lv_cents TYPE i. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - DATA(lv_price) = lo_cut->calculate_price( iv_pages = 1000 - iv_copies = 1 - iv_paper = 'A4' - iv_color = 'M' - iv_dept = 'SALE' ). - lv_cents = lv_price * 100. - cl_abap_unit_assert=>assert_equals( exp = 4500 act = lv_cents ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - ENDMETHOD. - - METHOD minimum_charge. - DATA lv_cents TYPE i. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - DATA(lv_price) = lo_cut->calculate_price( iv_pages = 10 - iv_copies = 1 - iv_paper = 'A4' - iv_color = 'M' - iv_dept = 'SALE' ). - lv_cents = lv_price * 100. - cl_abap_unit_assert=>assert_equals( exp = 100 act = lv_cents ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - ENDMETHOD. - - METHOD copies_multiply. - DATA lv_cents TYPE i. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - DATA(lv_price) = lo_cut->calculate_price( iv_pages = 200 - iv_copies = 2 - iv_paper = 'A3' - iv_color = 'C' - iv_dept = 'PROD' ). - lv_cents = lv_price * 100. - cl_abap_unit_assert=>assert_equals( exp = 14400 act = lv_cents ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - ENDMETHOD. - - METHOD rejects_zero_pages. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - lo_cut->calculate_price( iv_pages = 0 - iv_copies = 1 - iv_paper = 'A4' - iv_color = 'M' - iv_dept = 'SALE' ). - cl_abap_unit_assert=>fail( msg = 'exception expected' ). - CATCH {{p}}cx_print_job_error INTO DATA(lo_error). - cl_abap_unit_assert=>assert_equals( - exp = {{p}}cx_print_job_error=>c_reason-pages - act = lo_error->mv_reason ). - ENDTRY. - ENDMETHOD. - - METHOD rejects_zero_copies. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - lo_cut->calculate_price( iv_pages = 100 - iv_copies = 0 - iv_paper = 'A4' - iv_color = 'M' - iv_dept = 'SALE' ). - cl_abap_unit_assert=>fail( msg = 'exception expected' ). - CATCH {{p}}cx_print_job_error INTO DATA(lo_error). - cl_abap_unit_assert=>assert_equals( - exp = {{p}}cx_print_job_error=>c_reason-copies - act = lo_error->mv_reason ). - ENDTRY. - ENDMETHOD. - - METHOD rejects_unknown_values. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - lo_cut->calculate_price( iv_pages = 100 - iv_copies = 1 - iv_paper = 'B5' - iv_color = 'M' - iv_dept = 'SALE' ). - cl_abap_unit_assert=>fail( msg = 'exception expected' ). - CATCH {{p}}cx_print_job_error INTO DATA(lo_paper). - cl_abap_unit_assert=>assert_equals( - exp = {{p}}cx_print_job_error=>c_reason-paper - act = lo_paper->mv_reason ). - ENDTRY. - TRY. - lo_cut->calculate_price( iv_pages = 100 - iv_copies = 1 - iv_paper = 'A4' - iv_color = 'X' - iv_dept = 'SALE' ). - cl_abap_unit_assert=>fail( msg = 'exception expected' ). - CATCH {{p}}cx_print_job_error INTO DATA(lo_color). - cl_abap_unit_assert=>assert_equals( - exp = {{p}}cx_print_job_error=>c_reason-color - act = lo_color->mv_reason ). - ENDTRY. - TRY. - lo_cut->calculate_price( iv_pages = 100 - iv_copies = 1 - iv_paper = 'A4' - iv_color = 'M' - iv_dept = 'XYZ' ). - cl_abap_unit_assert=>fail( msg = 'exception expected' ). - CATCH {{p}}cx_print_job_error INTO DATA(lo_dept). - cl_abap_unit_assert=>assert_equals( - exp = {{p}}cx_print_job_error=>c_reason-dept - act = lo_dept->mv_reason ). - ENDTRY. - ENDMETHOD. - - METHOD rejects_over_limit. - DATA lv_cents TYPE i. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - lo_cut->calculate_price( iv_pages = 3000 - iv_copies = 2 - iv_paper = 'A4' - iv_color = 'M' - iv_dept = 'SALE' ). - cl_abap_unit_assert=>fail( msg = 'exception expected' ). - CATCH {{p}}cx_print_limit INTO DATA(lo_error). - cl_abap_unit_assert=>assert_equals( exp = 6000 - act = lo_error->mv_pages ). - ENDTRY. - TRY. - DATA(lv_price) = lo_cut->calculate_price( iv_pages = 5000 - iv_copies = 1 - iv_paper = 'A4' - iv_color = 'M' - iv_dept = 'SALE' ). - lv_cents = lv_price * 100. - cl_abap_unit_assert=>assert_equals( exp = 22500 act = lv_cents ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - ENDMETHOD. - - METHOD first_error_wins. - DATA(lo_cut) = NEW {{p}}print_job_pricer( ). - TRY. - lo_cut->calculate_price( iv_pages = 0 - iv_copies = 0 - iv_paper = 'B5' - iv_color = 'X' - iv_dept = 'XYZ' ). - cl_abap_unit_assert=>fail( msg = 'exception expected' ). - CATCH {{p}}cx_print_job_error INTO DATA(lo_error). - cl_abap_unit_assert=>assert_equals( - exp = {{p}}cx_print_job_error=>c_reason-pages - act = lo_error->mv_reason ). - ENDTRY. - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0129/mutation.json b/tasks_gen/eval/G0129/mutation.json new file mode 100644 index 0000000..0496c78 --- /dev/null +++ b/tasks_gen/eval/G0129/mutation.json @@ -0,0 +1,63 @@ +{ + "task": "G0129", + "mutants": [ + { + "object": "{{P}}COLD_CHAIN_CHECK", + "mutant": "line 84: <> -> = (rel)", + "status": "killed", + "hidden": "2/11", + "failed_tests": [ + "DURATION_TOO_SHORT", + "GAP_TOO_LARGE", + "NEGATIVE_MEAN_TRUNCATED", + "NO_START_AT_ZERO", + "OFFSETS_NOT_INCREASING", + "STRUCTURAL_ERROR_FIRST", + "TEMPERATURE_TOO_HIGH", + "TEMPERATURE_TOO_LOW", + "VALID_LOG_RETURNS_MEAN" + ] + }, + { + "object": "{{P}}COLD_CHAIN_CHECK", + "mutant": "line 89: 2 -> 3 (const)", + "status": "killed", + "hidden": "10/11", + "failed_tests": [ + "OFFSETS_NOT_INCREASING" + ] + }, + { + "object": "{{P}}COLD_CHAIN_CHECK", + "mutant": "line 138: = -> <> (eq)", + "status": "killed", + "hidden": "9/11", + "failed_tests": [ + "NEGATIVE_MEAN_TRUNCATED", + "VALID_LOG_RETURNS_MEAN" + ] + }, + { + "object": "{{P}}COLD_CHAIN_CHECK", + "mutant": "line 144: * -> / (arith)", + "status": "killed", + "hidden": "10/11", + "failed_tests": [ + "NEGATIVE_MEAN_TRUNCATED" + ] + }, + { + "object": "{{P}}COLD_CHAIN_CHECK", + "mutant": "line 148: * -> / (arith)", + "status": "killed", + "hidden": "10/11", + "failed_tests": [ + "NEGATIVE_MEAN_TRUNCATED" + ] + } + ], + "valid": 5, + "killed": 5, + "kill_rate": 1.0, + "ok": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0129/reference/cold_chain_check.clas.abap b/tasks_gen/eval/G0129/reference/cold_chain_check.clas.abap new file mode 100644 index 0000000..8db757f --- /dev/null +++ b/tasks_gen/eval/G0129/reference/cold_chain_check.clas.abap @@ -0,0 +1,151 @@ +CLASS {{p}}cold_chain_check DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES: BEGIN OF ty_reading, + offset_min TYPE i, + temp_tenths TYPE i, + END OF ty_reading, + tt_readings TYPE STANDARD TABLE OF ty_reading WITH EMPTY KEY, + BEGIN OF ty_config, + min_tenths TYPE i, + max_tenths TYPE i, + min_duration TYPE i, + max_gap TYPE i, + END OF ty_config. + + METHODS constructor + IMPORTING is_config TYPE ty_config. + + METHODS check + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i + RAISING {{p}}cx_cold_chain. + + PRIVATE SECTION. + DATA ms_config TYPE ty_config. + + METHODS first_violation + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_structure + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_duration + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_gap + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS check_temperatures + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_rule) TYPE string. + METHODS mean_tenths + IMPORTING it_readings TYPE tt_readings + RETURNING VALUE(rv_mean) TYPE i. +ENDCLASS. + + +CLASS {{p}}cold_chain_check IMPLEMENTATION. + METHOD constructor. + ms_config = is_config. + ENDMETHOD. + + METHOD check. + DATA(lv_rule) = first_violation( it_readings ). + IF lv_rule IS NOT INITIAL. + RAISE EXCEPTION TYPE {{p}}cx_cold_chain + EXPORTING + iv_rule = lv_rule. + ENDIF. + rv_mean = mean_tenths( it_readings ). + ENDMETHOD. + + METHOD first_violation. + rv_rule = check_structure( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_duration( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_gap( it_readings ). + IF rv_rule IS NOT INITIAL. + RETURN. + ENDIF. + rv_rule = check_temperatures( it_readings ). + ENDMETHOD. + + METHOD check_structure. + IF lines( it_readings ) < 2. + rv_rule = 'TOO_FEW'. + RETURN. + ENDIF. + READ TABLE it_readings INDEX 1 INTO DATA(ls_first). + IF ls_first-offset_min <> 0. + rv_rule = 'NO_START'. + RETURN. + ENDIF. + DATA(lv_previous) = ls_first-offset_min. + LOOP AT it_readings FROM 2 INTO DATA(ls_reading). + IF ls_reading-offset_min <= lv_previous. + rv_rule = 'TIME_ORDER'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_duration. + DATA lv_last TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_last = ls_reading-offset_min. + ENDLOOP. + IF lv_last < ms_config-min_duration. + rv_rule = 'TOO_SHORT'. + ENDIF. + ENDMETHOD. + + METHOD check_gap. + DATA lv_previous TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + IF sy-tabix > 1 AND ls_reading-offset_min - lv_previous > ms_config-max_gap. + rv_rule = 'GAP'. + RETURN. + ENDIF. + lv_previous = ls_reading-offset_min. + ENDLOOP. + ENDMETHOD. + + METHOD check_temperatures. + LOOP AT it_readings INTO DATA(ls_reading). + IF ls_reading-temp_tenths > ms_config-max_tenths. + rv_rule = 'TOO_HIGH'. + RETURN. + ENDIF. + IF ls_reading-temp_tenths < ms_config-min_tenths. + rv_rule = 'TOO_LOW'. + RETURN. + ENDIF. + ENDLOOP. + ENDMETHOD. + + METHOD mean_tenths. + DATA lv_sum TYPE i. + LOOP AT it_readings INTO DATA(ls_reading). + lv_sum = lv_sum + ls_reading-temp_tenths. + ENDLOOP. + DATA(lv_count) = lines( it_readings ). + IF lv_count = 0. + rv_mean = 0. + RETURN. + ENDIF. + DATA(lv_abs_sum) = lv_sum. + IF lv_abs_sum < 0. + lv_abs_sum = -1 * lv_abs_sum. + ENDIF. + rv_mean = lv_abs_sum DIV lv_count. + IF lv_sum < 0. + rv_mean = -1 * rv_mean. + ENDIF. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0129/reference/cold_chain_check.testclasses.abap b/tasks_gen/eval/G0129/reference/cold_chain_check.testclasses.abap new file mode 100644 index 0000000..216e65b --- /dev/null +++ b/tasks_gen/eval/G0129/reference/cold_chain_check.testclasses.abap @@ -0,0 +1,112 @@ +CLASS ltc_cold_chain DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + DATA mo_cut TYPE REF TO {{p}}cold_chain_check. + + METHODS setup. + METHODS mean_of + IMPORTING it_readings TYPE {{p}}cold_chain_check=>tt_readings + RETURNING VALUE(rv_mean) TYPE i. + METHODS rule_of + IMPORTING it_readings TYPE {{p}}cold_chain_check=>tt_readings + RETURNING VALUE(rv_rule) TYPE string. + + METHODS valid_log FOR TESTING. + METHODS empty_log FOR TESTING. + METHODS late_start FOR TESTING. + METHODS wrong_order FOR TESTING. + METHODS short_duration FOR TESTING. + METHODS long_gap FOR TESTING. + METHODS too_warm FOR TESTING. + METHODS too_cold FOR TESTING. +ENDCLASS. + + +CLASS ltc_cold_chain IMPLEMENTATION. + METHOD setup. + mo_cut = NEW {{p}}cold_chain_check( + is_config = VALUE #( min_tenths = 20 + max_tenths = 80 + min_duration = 120 + max_gap = 60 ) ). + ENDMETHOD. + + METHOD mean_of. + TRY. + rv_mean = mo_cut->check( it_readings ). + CATCH {{p}}cx_cold_chain INTO DATA(lx_error). + cl_abap_unit_assert=>fail( |Unexpected exception: { lx_error->mv_rule }| ). + ENDTRY. + ENDMETHOD. + + METHOD rule_of. + TRY. + mo_cut->check( it_readings ). + cl_abap_unit_assert=>fail( `Exception expected` ). + CATCH {{p}}cx_cold_chain INTO DATA(lx_error). + rv_rule = lx_error->mv_rule. + ENDTRY. + ENDMETHOD. + + METHOD valid_log. + DATA(lt_readings) = VALUE {{p}}cold_chain_check=>tt_readings( + ( offset_min = 0 temp_tenths = 40 ) + ( offset_min = 30 temp_tenths = 45 ) + ( offset_min = 60 temp_tenths = 50 ) + ( offset_min = 120 temp_tenths = 55 ) ). + cl_abap_unit_assert=>assert_equals( exp = 47 act = mean_of( lt_readings ) ). + ENDMETHOD. + + METHOD empty_log. + DATA(lt_readings) = VALUE {{p}}cold_chain_check=>tt_readings( ). + cl_abap_unit_assert=>assert_equals( exp = 'TOO_FEW' act = rule_of( lt_readings ) ). + ENDMETHOD. + + METHOD late_start. + DATA(lt_readings) = VALUE {{p}}cold_chain_check=>tt_readings( + ( offset_min = 10 temp_tenths = 40 ) + ( offset_min = 30 temp_tenths = 45 ) + ( offset_min = 120 temp_tenths = 50 ) ). + cl_abap_unit_assert=>assert_equals( exp = 'NO_START' act = rule_of( lt_readings ) ). + ENDMETHOD. + + METHOD wrong_order. + DATA(lt_readings) = VALUE {{p}}cold_chain_check=>tt_readings( + ( offset_min = 0 temp_tenths = 40 ) + ( offset_min = 60 temp_tenths = 45 ) + ( offset_min = 30 temp_tenths = 50 ) + ( offset_min = 120 temp_tenths = 55 ) ). + cl_abap_unit_assert=>assert_equals( exp = 'TIME_ORDER' act = rule_of( lt_readings ) ). + ENDMETHOD. + + METHOD short_duration. + DATA(lt_readings) = VALUE {{p}}cold_chain_check=>tt_readings( + ( offset_min = 0 temp_tenths = 40 ) + ( offset_min = 30 temp_tenths = 45 ) + ( offset_min = 90 temp_tenths = 50 ) ). + cl_abap_unit_assert=>assert_equals( exp = 'TOO_SHORT' act = rule_of( lt_readings ) ). + ENDMETHOD. + + METHOD long_gap. + DATA(lt_readings) = VALUE {{p}}cold_chain_check=>tt_readings( + ( offset_min = 0 temp_tenths = 40 ) + ( offset_min = 90 temp_tenths = 45 ) + ( offset_min = 120 temp_tenths = 50 ) ). + cl_abap_unit_assert=>assert_equals( exp = 'GAP' act = rule_of( lt_readings ) ). + ENDMETHOD. + + METHOD too_warm. + DATA(lt_readings) = VALUE {{p}}cold_chain_check=>tt_readings( + ( offset_min = 0 temp_tenths = 40 ) + ( offset_min = 60 temp_tenths = 85 ) + ( offset_min = 120 temp_tenths = 50 ) ). + cl_abap_unit_assert=>assert_equals( exp = 'TOO_HIGH' act = rule_of( lt_readings ) ). + ENDMETHOD. + + METHOD too_cold. + DATA(lt_readings) = VALUE {{p}}cold_chain_check=>tt_readings( + ( offset_min = 0 temp_tenths = 40 ) + ( offset_min = 60 temp_tenths = 15 ) + ( offset_min = 120 temp_tenths = 50 ) ). + cl_abap_unit_assert=>assert_equals( exp = 'TOO_LOW' act = rule_of( lt_readings ) ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0129/reference/cx_print_job_error.clas.abap b/tasks_gen/eval/G0129/reference/cx_print_job_error.clas.abap deleted file mode 100644 index 5635b72..0000000 --- a/tasks_gen/eval/G0129/reference/cx_print_job_error.clas.abap +++ /dev/null @@ -1,31 +0,0 @@ -CLASS {{p}}cx_print_job_error DEFINITION - PUBLIC - INHERITING FROM CX_ROOT - FINAL - CREATE PUBLIC. - PUBLIC SECTION. - TYPES ty_reason TYPE c LENGTH 10. - - CONSTANTS: - BEGIN OF c_reason, - pages TYPE ty_reason VALUE 'PAGES', - copies TYPE ty_reason VALUE 'COPIES', - paper TYPE ty_reason VALUE 'PAPER', - color TYPE ty_reason VALUE 'COLOR', - dept TYPE ty_reason VALUE 'DEPT', - END OF c_reason. - - DATA mv_reason TYPE ty_reason. - - METHODS constructor - IMPORTING - iv_reason TYPE ty_reason. -ENDCLASS. - - -CLASS {{p}}cx_print_job_error IMPLEMENTATION. - METHOD constructor. - super->constructor( ). - mv_reason = iv_reason. - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0129/reference/cx_print_limit.clas.abap b/tasks_gen/eval/G0129/reference/cx_print_limit.clas.abap deleted file mode 100644 index 1bad0ce..0000000 --- a/tasks_gen/eval/G0129/reference/cx_print_limit.clas.abap +++ /dev/null @@ -1,20 +0,0 @@ -CLASS {{p}}cx_print_limit DEFINITION - PUBLIC - INHERITING FROM CX_ROOT - FINAL - CREATE PUBLIC. - PUBLIC SECTION. - DATA mv_pages TYPE i. - - METHODS constructor - IMPORTING - iv_pages TYPE i. -ENDCLASS. - - -CLASS {{p}}cx_print_limit IMPLEMENTATION. - METHOD constructor. - super->constructor( ). - mv_pages = iv_pages. - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0129/reference/print_job_pricer.clas.abap b/tasks_gen/eval/G0129/reference/print_job_pricer.clas.abap deleted file mode 100644 index 79aa0ac..0000000 --- a/tasks_gen/eval/G0129/reference/print_job_pricer.clas.abap +++ /dev/null @@ -1,158 +0,0 @@ -CLASS {{p}}print_job_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC. - PUBLIC SECTION. - TYPES: - ty_paper TYPE c LENGTH 4, - ty_color TYPE c LENGTH 1, - ty_dept TYPE c LENGTH 4, - ty_price TYPE p LENGTH 8 DECIMALS 2. - - CONSTANTS: - BEGIN OF c_paper, - a3 TYPE ty_paper VALUE 'A3', - a4 TYPE ty_paper VALUE 'A4', - a5 TYPE ty_paper VALUE 'A5', - END OF c_paper, - BEGIN OF c_color, - mono TYPE ty_color VALUE 'M', - color TYPE ty_color VALUE 'C', - END OF c_color, - BEGIN OF c_dept, - sale TYPE ty_dept VALUE 'SALE', - hr TYPE ty_dept VALUE 'HR', - it TYPE ty_dept VALUE 'IT', - prod TYPE ty_dept VALUE 'PROD', - END OF c_dept, - c_max_pages TYPE i VALUE 5000, - c_min_cents TYPE i VALUE 100, - c_cents_a5 TYPE i VALUE 3, - c_cents_a4 TYPE i VALUE 5, - c_cents_a3 TYPE i VALUE 9, - c_color_factor TYPE i VALUE 4, - c_cents_per_unit TYPE i VALUE 100, - c_percent_base TYPE i VALUE 100, - c_percent_5 TYPE i VALUE 5, - c_percent_10 TYPE i VALUE 10, - c_pages_discount_5 TYPE i VALUE 500, - c_pages_discount_10 TYPE i VALUE 1000. - - METHODS calculate_price - IMPORTING - iv_pages TYPE i - iv_copies TYPE i - iv_paper TYPE ty_paper - iv_color TYPE ty_color - iv_dept TYPE ty_dept - RETURNING - VALUE(rv_price) TYPE ty_price - RAISING - {{p}}cx_print_job_error - {{p}}cx_print_limit. - - PRIVATE SECTION. - METHODS validate - IMPORTING - iv_pages TYPE i - iv_copies TYPE i - iv_paper TYPE ty_paper - iv_color TYPE ty_color - iv_dept TYPE ty_dept - RAISING - {{p}}cx_print_job_error. - METHODS page_price_cents - IMPORTING - iv_paper TYPE ty_paper - iv_color TYPE ty_color - RETURNING - VALUE(rv_cents) TYPE i. - METHODS discount_cents - IMPORTING - iv_total_pages TYPE i - iv_gross_cents TYPE i - RETURNING - VALUE(rv_cents) TYPE i. -ENDCLASS. - - -CLASS {{p}}print_job_pricer IMPLEMENTATION. - METHOD calculate_price. - validate( iv_pages = iv_pages - iv_copies = iv_copies - iv_paper = iv_paper - iv_color = iv_color - iv_dept = iv_dept ). - - DATA(lv_total_pages) = iv_pages * iv_copies. - IF lv_total_pages > c_max_pages. - RAISE EXCEPTION TYPE {{p}}cx_print_limit - EXPORTING - iv_pages = lv_total_pages. - ENDIF. - - DATA(lv_gross_cents) = lv_total_pages * page_price_cents( - iv_paper = iv_paper - iv_color = iv_color ). - DATA(lv_net_cents) = lv_gross_cents - discount_cents( - iv_total_pages = lv_total_pages - iv_gross_cents = lv_gross_cents ). - IF lv_net_cents < c_min_cents. - lv_net_cents = c_min_cents. - ENDIF. - - DATA(lv_net) = CONV ty_price( lv_net_cents ). - rv_price = lv_net / c_cents_per_unit. - ENDMETHOD. - - METHOD validate. - IF iv_pages < 1. - RAISE EXCEPTION TYPE {{p}}cx_print_job_error - EXPORTING iv_reason = {{p}}cx_print_job_error=>c_reason-pages. - ENDIF. - IF iv_copies < 1. - RAISE EXCEPTION TYPE {{p}}cx_print_job_error - EXPORTING iv_reason = {{p}}cx_print_job_error=>c_reason-copies. - ENDIF. - IF iv_paper <> c_paper-a4 AND iv_paper <> c_paper-a3 - AND iv_paper <> c_paper-a5. - RAISE EXCEPTION TYPE {{p}}cx_print_job_error - EXPORTING iv_reason = {{p}}cx_print_job_error=>c_reason-paper. - ENDIF. - IF iv_color <> c_color-color AND iv_color <> c_color-mono. - RAISE EXCEPTION TYPE {{p}}cx_print_job_error - EXPORTING iv_reason = {{p}}cx_print_job_error=>c_reason-color. - ENDIF. - IF iv_dept <> c_dept-sale AND iv_dept <> c_dept-hr - AND iv_dept <> c_dept-it AND iv_dept <> c_dept-prod. - RAISE EXCEPTION TYPE {{p}}cx_print_job_error - EXPORTING iv_reason = {{p}}cx_print_job_error=>c_reason-dept. - ENDIF. - ENDMETHOD. - - METHOD page_price_cents. - CASE iv_paper. - WHEN c_paper-a5. - rv_cents = c_cents_a5. - WHEN c_paper-a4. - rv_cents = c_cents_a4. - WHEN c_paper-a3. - rv_cents = c_cents_a3. - ENDCASE. - IF iv_color = c_color-color. - rv_cents = rv_cents * c_color_factor. - ENDIF. - ENDMETHOD. - - METHOD discount_cents. - DATA lv_percent TYPE i. - IF iv_total_pages >= c_pages_discount_10. - lv_percent = c_percent_10. - ELSEIF iv_total_pages >= c_pages_discount_5. - lv_percent = c_percent_5. - ELSE. - RETURN. - ENDIF. - DATA lv_gross TYPE ty_price. - lv_gross = iv_gross_cents. - DATA(lv_discount) = lv_gross * lv_percent / c_percent_base. - rv_cents = lv_discount. - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0129/reference/print_job_pricer.testclasses.abap b/tasks_gen/eval/G0129/reference/print_job_pricer.testclasses.abap deleted file mode 100644 index e146e69..0000000 --- a/tasks_gen/eval/G0129/reference/print_job_pricer.testclasses.abap +++ /dev/null @@ -1,104 +0,0 @@ -CLASS ltc_print_job_pricer DEFINITION FINAL FOR TESTING - DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - DATA mo_cut TYPE REF TO {{p}}print_job_pricer. - METHODS setup. - METHODS price - IMPORTING - iv_pages TYPE i - iv_copies TYPE i - iv_paper TYPE {{p}}print_job_pricer=>ty_paper - iv_color TYPE {{p}}print_job_pricer=>ty_color - iv_dept TYPE {{p}}print_job_pricer=>ty_dept - RETURNING - VALUE(rv_price) TYPE {{p}}print_job_pricer=>ty_price. - METHODS cents - IMPORTING - iv_cents TYPE i - RETURNING - VALUE(rv_price) TYPE {{p}}print_job_pricer=>ty_price. - METHODS a4_mono_price FOR TESTING. - METHODS color_price FOR TESTING. - METHODS volume_discount FOR TESTING. - METHODS minimum_charge FOR TESTING. - METHODS zero_pages_raises FOR TESTING. - METHODS over_limit_raises FOR TESTING. -ENDCLASS. - - -CLASS ltc_print_job_pricer IMPLEMENTATION. - METHOD setup. - mo_cut = NEW {{p}}print_job_pricer( ). - ENDMETHOD. - - METHOD price. - TRY. - rv_price = mo_cut->calculate_price( iv_pages = iv_pages - iv_copies = iv_copies - iv_paper = iv_paper - iv_color = iv_color - iv_dept = iv_dept ). - CATCH cx_root. - cl_abap_unit_assert=>fail( msg = 'unexpected exception' ). - ENDTRY. - ENDMETHOD. - - METHOD cents. - DATA lv_price TYPE {{p}}print_job_pricer=>ty_price. - lv_price = iv_cents. - rv_price = lv_price / 100. - ENDMETHOD. - - METHOD a4_mono_price. - cl_abap_unit_assert=>assert_equals( - exp = cents( 500 ) - act = price( iv_pages = 100 iv_copies = 1 - iv_paper = 'A4' iv_color = 'M' iv_dept = 'SALE' ) ). - ENDMETHOD. - - METHOD color_price. - cl_abap_unit_assert=>assert_equals( - exp = cents( 2000 ) - act = price( iv_pages = 100 iv_copies = 1 - iv_paper = 'A4' iv_color = 'C' iv_dept = 'SALE' ) ). - ENDMETHOD. - - METHOD volume_discount. - cl_abap_unit_assert=>assert_equals( - exp = cents( 2850 ) - act = price( iv_pages = 600 iv_copies = 1 - iv_paper = 'A4' iv_color = 'M' iv_dept = 'IT' ) ). - ENDMETHOD. - - METHOD minimum_charge. - cl_abap_unit_assert=>assert_equals( - exp = cents( 100 ) - act = price( iv_pages = 10 iv_copies = 1 - iv_paper = 'A4' iv_color = 'M' iv_dept = 'SALE' ) ). - ENDMETHOD. - - METHOD zero_pages_raises. - TRY. - mo_cut->calculate_price( iv_pages = 0 iv_copies = 1 - iv_paper = 'A4' iv_color = 'M' - iv_dept = 'SALE' ). - cl_abap_unit_assert=>fail( msg = 'exception expected' ). - CATCH {{p}}cx_print_job_error INTO DATA(lo_error). - cl_abap_unit_assert=>assert_equals( - exp = {{p}}cx_print_job_error=>c_reason-pages - act = lo_error->mv_reason ). - ENDTRY. - ENDMETHOD. - - METHOD over_limit_raises. - TRY. - mo_cut->calculate_price( iv_pages = 3000 iv_copies = 2 - iv_paper = 'A4' iv_color = 'M' - iv_dept = 'SALE' ). - cl_abap_unit_assert=>fail( msg = 'exception expected' ). - CATCH {{p}}cx_print_limit INTO DATA(lo_error). - cl_abap_unit_assert=>assert_equals( exp = 6000 - act = lo_error->mv_pages ). - ENDTRY. - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0129/seed/cx_cold_chain.clas.abap b/tasks_gen/eval/G0129/seed/cx_cold_chain.clas.abap new file mode 100644 index 0000000..50b7b04 --- /dev/null +++ b/tasks_gen/eval/G0129/seed/cx_cold_chain.clas.abap @@ -0,0 +1,23 @@ +CLASS {{p}}cx_cold_chain DEFINITION PUBLIC INHERITING FROM cx_static_check FINAL CREATE PUBLIC. + PUBLIC SECTION. + DATA mv_rule TYPE string READ-ONLY. + + METHODS constructor + IMPORTING iv_rule TYPE string. + + METHODS get_text REDEFINITION. + + PRIVATE SECTION. +ENDCLASS. + + +CLASS {{p}}cx_cold_chain IMPLEMENTATION. + METHOD constructor. + super->constructor( ). + mv_rule = iv_rule. + ENDMETHOD. + + METHOD get_text. + result = |Cold chain check failed: { mv_rule }|. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0129/spec.md b/tasks_gen/eval/G0129/spec.md index 2bed35c..9b30e10 100644 --- a/tasks_gen/eval/G0129/spec.md +++ b/tasks_gen/eval/G0129/spec.md @@ -1,85 +1,62 @@ # 1. Goal -Calculate the internal price of a print job for the print shop of a company. A -billing program calls the calculation before it charges the cost centre of a -department. Invalid job data must raise a class-based exception. +Check the temperature log of a refrigerated shipment. A logistics program calls the +check before it releases the shipment. The check must give one reason code for each +log that is not correct. # 2. Open questions None. # 3. Context -- Package $TMP. No other object exists for this topic. -- The billing program catches the exceptions and shows the reason to the user. - The names of the classes and their public components are fixed. +- The exception class {{P}}CX_COLD_CHAIN exists in package $TMP. It is active. +- The class inherits from CX_STATIC_CHECK. It has the read-only attribute MV_RULE + (type STRING), the constructor with the importing parameter IV_RULE (type STRING), + and the redefined method GET_TEXT. +- GET_TEXT returns the text Cold chain check failed: . +- A temperature log is a table of readings. One reading has the time offset in + minutes (OFFSET_MIN) and the temperature in tenths of a degree Celsius + (TEMP_TENTHS). Example: the value -185 means -18.5 degrees Celsius. # 4. Contract -Create three classes in package $TMP. - -## {{P}}CX_PRINT_JOB_ERROR -- Public, final, inherits from CX_ROOT. -- Public type TY_REASON, character 10. -- Public constant structure C_REASON with the components PAGES, COPIES, PAPER, - COLOR and DEPT. The values are 'PAGES', 'COPIES', 'PAPER', 'COLOR' and - 'DEPT'. -- Public attribute MV_REASON of type TY_REASON. -- Public constructor with the importing parameter IV_REASON of type TY_REASON. - The constructor writes IV_REASON to MV_REASON. - -## {{P}}CX_PRINT_LIMIT -- Public, final, inherits from CX_ROOT. -- Public attribute MV_PAGES of type I. -- Public constructor with the importing parameter IV_PAGES of type I. The - constructor writes IV_PAGES to MV_PAGES. - -## {{P}}PRINT_JOB_PRICER -- Public, final, public constructor without parameters. -- Public types: TY_PAPER (character 4), TY_COLOR (character 1), TY_DEPT - (character 4), TY_PRICE (packed number, length 8, 2 decimals). -- Public method CALCULATE_PRICE with these parameters: - - IMPORTING IV_PAGES TYPE I - - IMPORTING IV_COPIES TYPE I - - IMPORTING IV_PAPER TYPE TY_PAPER - - IMPORTING IV_COLOR TYPE TY_COLOR - - IMPORTING IV_DEPT TYPE TY_DEPT - - RETURNING VALUE(RV_PRICE) TYPE TY_PRICE - - RAISING {{P}}CX_PRINT_JOB_ERROR and {{P}}CX_PRINT_LIMIT +- Create the class {{P}}COLD_CHAIN_CHECK in package $TMP. +- The class is public, final, and has a public constructor. +- The class has these public types: + - TY_READING: a structure with the fields OFFSET_MIN (type I) and TEMP_TENTHS + (type I). + - TT_READINGS: a standard table of TY_READING with an empty key. + - TY_CONFIG: a structure with the fields MIN_TENTHS (type I), MAX_TENTHS + (type I), MIN_DURATION (type I), and MAX_GAP (type I). +- The constructor has the importing parameter IS_CONFIG of type TY_CONFIG. +- The class has the method CHECK with the importing parameter IT_READINGS of type + TT_READINGS, the returning parameter RV_MEAN of type I, and the addition + RAISING {{P}}CX_COLD_CHAIN. - Do not add other public methods. +- Do not change {{P}}CX_COLD_CHAIN. # 5. Business rules -Apply the rules in this sequence. - -1. Check the input in this order. Raise the exception of the first rule that - fails. - 1. IV_PAGES is smaller than 1: raise {{P}}CX_PRINT_JOB_ERROR with the - reason PAGES. - 2. IV_COPIES is smaller than 1: raise {{P}}CX_PRINT_JOB_ERROR with the - reason COPIES. - 3. IV_PAPER is not 'A4', 'A3' or 'A5': raise {{P}}CX_PRINT_JOB_ERROR with - the reason PAPER. - 4. IV_COLOR is not 'C' or 'M': raise {{P}}CX_PRINT_JOB_ERROR with the - reason COLOR. - 5. IV_DEPT is not 'SALE', 'HR', 'IT' or 'PROD': raise - {{P}}CX_PRINT_JOB_ERROR with the reason DEPT. -2. The total number of pages is IV_PAGES multiplied by IV_COPIES. -3. If the total number of pages is greater than 5000, raise - {{P}}CX_PRINT_LIMIT with MV_PAGES equal to the total number of pages. -4. The price of one page is 0.03 for A5, 0.05 for A4 and 0.09 for A3. For the - color mode 'C', multiply the price of one page by 4. -5. The gross price is the total number of pages multiplied by the price of one - page. -6. Volume discount on the gross price: 10 per cent if the total number of - pages is 1000 or more, 5 per cent if the total number of pages is 500 or - more, otherwise no discount. -7. The net price is the gross price minus the discount. -8. If the net price is smaller than 1.00, the price is 1.00 (minimum charge). -9. Return the price. +Apply the rules in this sequence. Raise the exception {{P}}CX_COLD_CHAIN with the +rule code of the first rule that fails. Pass the rule code in the parameter IV_RULE. +The rule codes are the character strings TOO_FEW, NO_START, TIME_ORDER, TOO_SHORT, +GAP, TOO_HIGH, and TOO_LOW. +The caller always passes a configuration with MIN_TENTHS less than or equal to +MAX_TENTHS. +1. If IT_READINGS has less than 2 entries, use TOO_FEW. +2. If the offset of the first entry is not 0, use NO_START. +3. If the offsets are not strictly increasing, use TIME_ORDER. +4. If the offset of the last entry is less than MIN_DURATION, use TOO_SHORT. +5. If the difference between the offsets of two consecutive entries is greater than + MAX_GAP, use GAP. +6. Read the entries in the table order. If TEMP_TENTHS is greater than MAX_TENTHS, + use TOO_HIGH. If TEMP_TENTHS is less than MIN_TENTHS, use TOO_LOW. +7. Else return the sum of all TEMP_TENTHS divided by the number of entries. Truncate + the result toward zero. # 6. Constraints -- Release target: SAP_BASIS 8.16. +- Release target: 8.16. - Coding standards: Clean ABAP. Method length below 40 statements. No global variables. No comment that restates the code. -- Out of scope: no database table, no report, no function module, no CDS view. +- Out of scope: do not change {{P}}CX_COLD_CHAIN. # 7. Acceptance -- The three classes are active and have no syntax error. +- The class is active and has no syntax error. - The hidden tests pass. -- Write your own ABAP Unit tests for {{P}}PRINT_JOB_PRICER. +- Write your own ABAP Unit tests for the class. diff --git a/tasks_gen/eval/G0129/task.json b/tasks_gen/eval/G0129/task.json index 2a931af..d4ddc41 100644 --- a/tasks_gen/eval/G0129/task.json +++ b/tasks_gen/eval/G0129/task.json @@ -9,58 +9,43 @@ "max_tool_calls": 60, "max_activations": 15 }, - "seed": [], + "seed": [ + { + "type": "CLAS", + "name": "{{P}}CX_COLD_CHAIN", + "file": "seed/cx_cold_chain.clas.abap", + "description": "Class-based exception for a failed cold chain check. It carries the rule code and returns a message text." + } + ], "contract": [ { "type": "CLAS", - "name": "{{P}}CX_PRINT_JOB_ERROR" - }, - { - "type": "CLAS", - "name": "{{P}}CX_PRINT_LIMIT" - }, - { - "type": "CLAS", - "name": "{{P}}PRINT_JOB_PRICER" + "name": "{{P}}COLD_CHAIN_CHECK" } ], "out_of_scope": [ - "Database tables", - "Reports", - "Function modules", - "CDS views" + "{{P}}CX_COLD_CHAIN" ], "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}T_PRINT_HIDDEN", - "file": "hidden/t_print_hidden.clas.abap", - "description": "Hidden tests for the print job price" + "name": "{{P}}COLD_CHAIN_HIDDEN", + "file": "hidden/cold_chain_hidden.clas.abap", + "description": "Hidden ABAP Unit tests for the cold chain check: all seven rules, the rule order, the truncated mean and the exception text." } ], "reference": [ { "type": "CLAS", - "name": "{{P}}CX_PRINT_JOB_ERROR", - "file": "reference/cx_print_job_error.clas.abap", - "description": "Invalid print job data" - }, - { - "type": "CLAS", - "name": "{{P}}CX_PRINT_LIMIT", - "file": "reference/cx_print_limit.clas.abap", - "description": "Print job above the page limit" - }, - { - "type": "CLAS", - "name": "{{P}}PRINT_JOB_PRICER", - "file": "reference/print_job_pricer.clas.abap", - "description": "Print job price", - "testclasses_file": "reference/print_job_pricer.testclasses.abap" + "name": "{{P}}COLD_CHAIN_CHECK", + "file": "reference/cold_chain_check.clas.abap", + "description": "Cold chain checker that raises {{P}}CX_COLD_CHAIN with the rule code of the first failing rule.", + "testclasses_file": "reference/cold_chain_check.testclasses.abap" } ], "craft_checks": [ "method_length", - "db_operation_in_loop" + "class_based_exception", + "no_global_variables" ] } \ No newline at end of file diff --git a/tasks_gen/eval/G0130/faulty/m0_provision_calc.clas.abap b/tasks_gen/eval/G0130/faulty/m0_provision_calc.clas.abap new file mode 100644 index 0000000..4516020 --- /dev/null +++ b/tasks_gen/eval/G0130/faulty/m0_provision_calc.clas.abap @@ -0,0 +1,115 @@ +CLASS {{p}}provision_calc DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES: + ty_material TYPE c LENGTH 18, + ty_quantity TYPE p LENGTH 13 DECIMALS 3, + ty_price TYPE p LENGTH 11 DECIMALS 2, + ty_amount TYPE p LENGTH 13 DECIMALS 2, + ty_reason TYPE c LENGTH 20. + + TYPES: + BEGIN OF ty_line, + material TYPE ty_material, + quantity TYPE ty_quantity, + price TYPE ty_price, + END OF ty_line. + + TYPES tt_lines TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY. + + CONSTANTS: + c_max_lines TYPE i VALUE 999, + c_value_limit TYPE ty_amount VALUE '100000.00', + c_empty_order TYPE ty_reason VALUE 'EMPTY_ORDER', + c_too_many_lines TYPE ty_reason VALUE 'TOO_MANY_LINES', + c_material_missing TYPE ty_reason VALUE 'MATERIAL_MISSING', + c_quantity_invalid TYPE ty_reason VALUE 'QUANTITY_INVALID', + c_price_negative TYPE ty_reason VALUE 'PRICE_NEGATIVE', + c_duplicate_material TYPE ty_reason VALUE 'DUPLICATE_MATERIAL', + c_limit_exceeded TYPE ty_reason VALUE 'LIMIT_EXCEEDED'. + + METHODS constructor. + + METHODS check_order + IMPORTING it_lines TYPE tt_lines + RAISING {{p}}cx_prov_error. + + METHODS calculate_value + IMPORTING it_lines TYPE tt_lines + RETURNING VALUE(rv_value) TYPE ty_amount + RAISING {{p}}cx_prov_error. + + PRIVATE SECTION. + TYPES tt_materials TYPE HASHED TABLE OF ty_material WITH UNIQUE KEY table_line. + + METHODS check_lines + IMPORTING it_lines TYPE tt_lines + RAISING {{p}}cx_prov_error. + + METHODS total_value + IMPORTING it_lines TYPE tt_lines + RETURNING VALUE(rv_value) TYPE ty_amount. + + METHODS raise_error + IMPORTING iv_reason TYPE ty_reason + RAISING {{p}}cx_prov_error. +ENDCLASS. + + +CLASS {{p}}provision_calc IMPLEMENTATION. + METHOD constructor. + ENDMETHOD. + + METHOD check_order. + IF it_lines IS INITIAL. + raise_error( c_empty_order ). + ENDIF. + + IF lines( it_lines ) <= c_max_lines. + raise_error( c_too_many_lines ). + ENDIF. + + check_lines( it_lines ). + + IF total_value( it_lines ) > c_value_limit. + raise_error( c_limit_exceeded ). + ENDIF. + ENDMETHOD. + + METHOD calculate_value. + check_order( it_lines ). + rv_value = total_value( it_lines ). + ENDMETHOD. + + METHOD check_lines. + DATA lt_seen TYPE tt_materials. + LOOP AT it_lines INTO DATA(ls_line). + IF ls_line-material IS INITIAL. + raise_error( c_material_missing ). + ENDIF. + IF ls_line-quantity <= 0. + raise_error( c_quantity_invalid ). + ENDIF. + IF ls_line-price < 0. + raise_error( c_price_negative ). + ENDIF. + IF line_exists( lt_seen[ table_line = ls_line-material ] ). + raise_error( c_duplicate_material ). + ENDIF. + INSERT ls_line-material INTO TABLE lt_seen. + ENDLOOP. + ENDMETHOD. + + METHOD total_value. + DATA lv_total TYPE p LENGTH 16 DECIMALS 5. + LOOP AT it_lines INTO DATA(ls_line). + lv_total = lv_total + ls_line-quantity * ls_line-price. + ENDLOOP. + rv_value = round( val = lv_total dec = 2 ). + ENDMETHOD. + + METHOD raise_error. + RAISE EXCEPTION TYPE {{p}}cx_prov_error + EXPORTING + iv_reason = iv_reason. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0130/faulty/m1_provision_calc.clas.abap b/tasks_gen/eval/G0130/faulty/m1_provision_calc.clas.abap new file mode 100644 index 0000000..0e6aae1 --- /dev/null +++ b/tasks_gen/eval/G0130/faulty/m1_provision_calc.clas.abap @@ -0,0 +1,115 @@ +CLASS {{p}}provision_calc DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES: + ty_material TYPE c LENGTH 18, + ty_quantity TYPE p LENGTH 13 DECIMALS 3, + ty_price TYPE p LENGTH 11 DECIMALS 2, + ty_amount TYPE p LENGTH 13 DECIMALS 2, + ty_reason TYPE c LENGTH 20. + + TYPES: + BEGIN OF ty_line, + material TYPE ty_material, + quantity TYPE ty_quantity, + price TYPE ty_price, + END OF ty_line. + + TYPES tt_lines TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY. + + CONSTANTS: + c_max_lines TYPE i VALUE 999, + c_value_limit TYPE ty_amount VALUE '100000.00', + c_empty_order TYPE ty_reason VALUE 'EMPTY_ORDER', + c_too_many_lines TYPE ty_reason VALUE 'TOO_MANY_LINES', + c_material_missing TYPE ty_reason VALUE 'MATERIAL_MISSING', + c_quantity_invalid TYPE ty_reason VALUE 'QUANTITY_INVALID', + c_price_negative TYPE ty_reason VALUE 'PRICE_NEGATIVE', + c_duplicate_material TYPE ty_reason VALUE 'DUPLICATE_MATERIAL', + c_limit_exceeded TYPE ty_reason VALUE 'LIMIT_EXCEEDED'. + + METHODS constructor. + + METHODS check_order + IMPORTING it_lines TYPE tt_lines + RAISING {{p}}cx_prov_error. + + METHODS calculate_value + IMPORTING it_lines TYPE tt_lines + RETURNING VALUE(rv_value) TYPE ty_amount + RAISING {{p}}cx_prov_error. + + PRIVATE SECTION. + TYPES tt_materials TYPE HASHED TABLE OF ty_material WITH UNIQUE KEY table_line. + + METHODS check_lines + IMPORTING it_lines TYPE tt_lines + RAISING {{p}}cx_prov_error. + + METHODS total_value + IMPORTING it_lines TYPE tt_lines + RETURNING VALUE(rv_value) TYPE ty_amount. + + METHODS raise_error + IMPORTING iv_reason TYPE ty_reason + RAISING {{p}}cx_prov_error. +ENDCLASS. + + +CLASS {{p}}provision_calc IMPLEMENTATION. + METHOD constructor. + ENDMETHOD. + + METHOD check_order. + IF it_lines IS INITIAL. + raise_error( c_empty_order ). + ENDIF. + + IF lines( it_lines ) > c_max_lines. + raise_error( c_too_many_lines ). + ENDIF. + + check_lines( it_lines ). + + IF total_value( it_lines ) <= c_value_limit. + raise_error( c_limit_exceeded ). + ENDIF. + ENDMETHOD. + + METHOD calculate_value. + check_order( it_lines ). + rv_value = total_value( it_lines ). + ENDMETHOD. + + METHOD check_lines. + DATA lt_seen TYPE tt_materials. + LOOP AT it_lines INTO DATA(ls_line). + IF ls_line-material IS INITIAL. + raise_error( c_material_missing ). + ENDIF. + IF ls_line-quantity <= 0. + raise_error( c_quantity_invalid ). + ENDIF. + IF ls_line-price < 0. + raise_error( c_price_negative ). + ENDIF. + IF line_exists( lt_seen[ table_line = ls_line-material ] ). + raise_error( c_duplicate_material ). + ENDIF. + INSERT ls_line-material INTO TABLE lt_seen. + ENDLOOP. + ENDMETHOD. + + METHOD total_value. + DATA lv_total TYPE p LENGTH 16 DECIMALS 5. + LOOP AT it_lines INTO DATA(ls_line). + lv_total = lv_total + ls_line-quantity * ls_line-price. + ENDLOOP. + rv_value = round( val = lv_total dec = 2 ). + ENDMETHOD. + + METHOD raise_error. + RAISE EXCEPTION TYPE {{p}}cx_prov_error + EXPORTING + iv_reason = iv_reason. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0130/faulty/m3_provision_calc.clas.abap b/tasks_gen/eval/G0130/faulty/m3_provision_calc.clas.abap new file mode 100644 index 0000000..a981e5c --- /dev/null +++ b/tasks_gen/eval/G0130/faulty/m3_provision_calc.clas.abap @@ -0,0 +1,115 @@ +CLASS {{p}}provision_calc DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES: + ty_material TYPE c LENGTH 18, + ty_quantity TYPE p LENGTH 13 DECIMALS 3, + ty_price TYPE p LENGTH 11 DECIMALS 2, + ty_amount TYPE p LENGTH 13 DECIMALS 2, + ty_reason TYPE c LENGTH 20. + + TYPES: + BEGIN OF ty_line, + material TYPE ty_material, + quantity TYPE ty_quantity, + price TYPE ty_price, + END OF ty_line. + + TYPES tt_lines TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY. + + CONSTANTS: + c_max_lines TYPE i VALUE 999, + c_value_limit TYPE ty_amount VALUE '100000.00', + c_empty_order TYPE ty_reason VALUE 'EMPTY_ORDER', + c_too_many_lines TYPE ty_reason VALUE 'TOO_MANY_LINES', + c_material_missing TYPE ty_reason VALUE 'MATERIAL_MISSING', + c_quantity_invalid TYPE ty_reason VALUE 'QUANTITY_INVALID', + c_price_negative TYPE ty_reason VALUE 'PRICE_NEGATIVE', + c_duplicate_material TYPE ty_reason VALUE 'DUPLICATE_MATERIAL', + c_limit_exceeded TYPE ty_reason VALUE 'LIMIT_EXCEEDED'. + + METHODS constructor. + + METHODS check_order + IMPORTING it_lines TYPE tt_lines + RAISING {{p}}cx_prov_error. + + METHODS calculate_value + IMPORTING it_lines TYPE tt_lines + RETURNING VALUE(rv_value) TYPE ty_amount + RAISING {{p}}cx_prov_error. + + PRIVATE SECTION. + TYPES tt_materials TYPE HASHED TABLE OF ty_material WITH UNIQUE KEY table_line. + + METHODS check_lines + IMPORTING it_lines TYPE tt_lines + RAISING {{p}}cx_prov_error. + + METHODS total_value + IMPORTING it_lines TYPE tt_lines + RETURNING VALUE(rv_value) TYPE ty_amount. + + METHODS raise_error + IMPORTING iv_reason TYPE ty_reason + RAISING {{p}}cx_prov_error. +ENDCLASS. + + +CLASS {{p}}provision_calc IMPLEMENTATION. + METHOD constructor. + ENDMETHOD. + + METHOD check_order. + IF it_lines IS INITIAL. + raise_error( c_empty_order ). + ENDIF. + + IF lines( it_lines ) > c_max_lines. + raise_error( c_too_many_lines ). + ENDIF. + + check_lines( it_lines ). + + IF total_value( it_lines ) > c_value_limit. + raise_error( c_limit_exceeded ). + ENDIF. + ENDMETHOD. + + METHOD calculate_value. + check_order( it_lines ). + rv_value = total_value( it_lines ). + ENDMETHOD. + + METHOD check_lines. + DATA lt_seen TYPE tt_materials. + LOOP AT it_lines INTO DATA(ls_line). + IF ls_line-material IS INITIAL. + raise_error( c_material_missing ). + ENDIF. + IF ls_line-quantity <= 0. + raise_error( c_quantity_invalid ). + ENDIF. + IF ls_line-price < 0. + raise_error( c_price_negative ). + ENDIF. + IF line_exists( lt_seen[ table_line = ls_line-material ] ). + raise_error( c_duplicate_material ). + ENDIF. + INSERT ls_line-material INTO TABLE lt_seen. + ENDLOOP. + ENDMETHOD. + + METHOD total_value. + DATA lv_total TYPE p LENGTH 16 DECIMALS 5. + LOOP AT it_lines INTO DATA(ls_line). + lv_total = lv_total - ls_line-quantity * ls_line-price. + ENDLOOP. + rv_value = round( val = lv_total dec = 2 ). + ENDMETHOD. + + METHOD raise_error. + RAISE EXCEPTION TYPE {{p}}cx_prov_error + EXPORTING + iv_reason = iv_reason. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0130/generation.json b/tasks_gen/eval/G0130/generation.json new file mode 100644 index 0000000..b05492d --- /dev/null +++ b/tasks_gen/eval/G0130/generation.json @@ -0,0 +1,29 @@ +{ + "id": "G0130", + "pool": "eval", + "object_type": "CLAS", + "category": "D", + "attempts": [ + { + "stage": "validate", + "oracle": null, + "null": null + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 100.0, + "null": 0, + "mutation": { + "valid": 4, + "killed": 3, + "ok": true + } + } + ], + "accepted": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0130/hidden/t02_hidden.clas.abap b/tasks_gen/eval/G0130/hidden/t02_hidden.clas.abap deleted file mode 100644 index 8eb0d61..0000000 --- a/tasks_gen/eval/G0130/hidden/t02_hidden.clas.abap +++ /dev/null @@ -1,156 +0,0 @@ -CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - DATA mo_cut TYPE REF TO {{p}}prescription_check. - - METHODS setup. - METHODS empty_prescription FOR TESTING. - METHODS expired_prescription FOR TESTING. - METHODS valid_on_last_day FOR TESTING. - METHODS unknown_drug FOR TESTING. - METHODS zero_quantity FOR TESTING. - METHODS zero_daily_dose FOR TESTING. - METHODS dose_above_max FOR TESTING. - METHODS duplicate_drug FOR TESTING. - METHODS expired_before_quantity FOR TESTING. - METHODS dose_before_duplicate FOR TESTING. - METHODS valid_prescription FOR TESTING. - METHODS message_texts FOR TESTING. - - METHODS valid_item - RETURNING VALUE(rt_item) TYPE {{p}}prescription_check=>tt_item. - METHODS expect_reason - IMPORTING iv_reason TYPE {{p}}cx_presc_error=>ty_reason - it_item TYPE {{p}}prescription_check=>tt_item - iv_as_of TYPE d DEFAULT '20240110'. - METHODS expect_no_error - IMPORTING it_item TYPE {{p}}prescription_check=>tt_item - iv_as_of TYPE d DEFAULT '20240110'. -ENDCLASS. - - -CLASS {{p}}t02_hidden IMPLEMENTATION. - METHOD setup. - mo_cut = NEW {{p}}prescription_check( ). - ENDMETHOD. - - METHOD valid_item. - rt_item = VALUE #( ( drug_id = 'PARA500' quantity = 20 daily_dose = 1000 ) ). - ENDMETHOD. - - METHOD expect_reason. - DATA lv_raised TYPE abap_bool. - TRY. - mo_cut->validate( iv_issue_date = '20240101' - iv_valid_days = 30 - iv_as_of_date = iv_as_of - it_item = it_item ). - CATCH {{p}}cx_presc_error INTO DATA(lx_error). - lv_raised = abap_true. - cl_abap_unit_assert=>assert_equals( exp = iv_reason - act = lx_error->get_reason( ) ). - ENDTRY. - cl_abap_unit_assert=>assert_true( act = lv_raised - msg = |No exception with reason { iv_reason }| ). - ENDMETHOD. - - METHOD expect_no_error. - DATA lv_raised TYPE abap_bool. - TRY. - mo_cut->validate( iv_issue_date = '20240101' - iv_valid_days = 30 - iv_as_of_date = iv_as_of - it_item = it_item ). - CATCH {{p}}cx_presc_error. - lv_raised = abap_true. - ENDTRY. - cl_abap_unit_assert=>assert_false( act = lv_raised ). - ENDMETHOD. - - METHOD empty_prescription. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-empty - it_item = VALUE {{p}}prescription_check=>tt_item( ) ). - ENDMETHOD. - - METHOD expired_prescription. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-expired - it_item = valid_item( ) - iv_as_of = '20240201' ). - ENDMETHOD. - - METHOD valid_on_last_day. - expect_no_error( it_item = valid_item( ) - iv_as_of = '20240131' ). - ENDMETHOD. - - METHOD unknown_drug. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-unknown - it_item = VALUE #( ( drug_id = 'XXXXXX' quantity = 5 daily_dose = 10 ) ) ). - ENDMETHOD. - - METHOD zero_quantity. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-quantity - it_item = VALUE #( ( drug_id = 'PARA500' quantity = 0 daily_dose = 1000 ) ) ). - ENDMETHOD. - - METHOD zero_daily_dose. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-dose - it_item = VALUE #( ( drug_id = 'PARA500' quantity = 5 daily_dose = 0 ) ) ). - ENDMETHOD. - - METHOD dose_above_max. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-dose - it_item = VALUE #( ( drug_id = 'META50' quantity = 5 daily_dose = 250 ) ) ). - ENDMETHOD. - - METHOD duplicate_drug. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-duplicate - it_item = VALUE #( ( drug_id = 'PARA500' quantity = 5 daily_dose = 1000 ) - ( drug_id = 'PARA500' quantity = 5 daily_dose = 1000 ) ) ). - ENDMETHOD. - - METHOD expired_before_quantity. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-expired - it_item = VALUE #( ( drug_id = 'PARA500' quantity = 0 daily_dose = 1000 ) ) - iv_as_of = '20240201' ). - ENDMETHOD. - - METHOD dose_before_duplicate. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-dose - it_item = VALUE #( ( drug_id = 'META50' quantity = 5 daily_dose = 250 ) - ( drug_id = 'META50' quantity = 5 daily_dose = 100 ) ) ). - ENDMETHOD. - - METHOD valid_prescription. - expect_no_error( it_item = VALUE #( ( drug_id = 'PARA500' quantity = 20 daily_dose = 4000 ) - ( drug_id = 'IBU400' quantity = 10 daily_dose = 1200 ) ) ). - ENDMETHOD. - - METHOD message_texts. - DATA lo_error TYPE REF TO {{p}}cx_presc_error. - - lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-empty ). - cl_abap_unit_assert=>assert_equals( exp = 'The prescription has no items' - act = lo_error->get_message_text( ) ). - - lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-expired ). - cl_abap_unit_assert=>assert_equals( exp = 'The prescription is expired' - act = lo_error->get_message_text( ) ). - - lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-quantity ). - cl_abap_unit_assert=>assert_equals( exp = 'The quantity is not positive' - act = lo_error->get_message_text( ) ). - - lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-unknown ). - cl_abap_unit_assert=>assert_equals( exp = 'The drug is not in the drug master' - act = lo_error->get_message_text( ) ). - - lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-dose ). - cl_abap_unit_assert=>assert_equals( exp = 'The daily dose is not allowed' - act = lo_error->get_message_text( ) ). - - lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-duplicate ). - cl_abap_unit_assert=>assert_equals( exp = 'The drug appears more than once' - act = lo_error->get_message_text( ) ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0130/hidden/t_prov_hidden.clas.abap b/tasks_gen/eval/G0130/hidden/t_prov_hidden.clas.abap new file mode 100644 index 0000000..29bea9f --- /dev/null +++ b/tasks_gen/eval/G0130/hidden/t_prov_hidden.clas.abap @@ -0,0 +1,157 @@ +CLASS {{p}}t_prov_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + DATA mo_cut TYPE REF TO {{p}}provision_calc. + + METHODS setup. + METHODS empty_order_raises FOR TESTING. + METHODS too_many_lines_raises FOR TESTING. + METHODS material_missing_raises FOR TESTING. + METHODS quantity_invalid_raises FOR TESTING. + METHODS price_negative_raises FOR TESTING. + METHODS duplicate_material_raises FOR TESTING. + METHODS limit_exceeded_raises FOR TESTING. + METHODS limit_boundary_is_ok FOR TESTING. + METHODS valid_order_is_ok FOR TESTING. + METHODS value_is_sum FOR TESTING. + METHODS value_rounds_total FOR TESTING. + METHODS invalid_order_propagates FOR TESTING. + + METHODS expect_reason + IMPORTING it_lines TYPE {{p}}provision_calc=>tt_lines + iv_reason TYPE {{p}}provision_calc=>ty_reason. +ENDCLASS. + + +CLASS {{p}}t_prov_hidden IMPLEMENTATION. + METHOD setup. + mo_cut = NEW {{p}}provision_calc( ). + ENDMETHOD. + + METHOD expect_reason. + TRY. + mo_cut->check_order( it_lines ). + cl_abap_unit_assert=>fail( msg = |Expected reason { iv_reason }| ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>assert_equals( exp = iv_reason act = lx_error->reason ). + ENDTRY. + ENDMETHOD. + + METHOD empty_order_raises. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + expect_reason( it_lines = lt_lines + iv_reason = {{p}}provision_calc=>c_empty_order ). + ENDMETHOD. + + METHOD too_many_lines_raises. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + DATA ls_line TYPE {{p}}provision_calc=>ty_line. + DO 1000 TIMES. + ls_line = VALUE #( material = |M{ sy-index }| quantity = 1 price = 1 ). + INSERT ls_line INTO TABLE lt_lines. + ENDDO. + expect_reason( it_lines = lt_lines + iv_reason = {{p}}provision_calc=>c_too_many_lines ). + ENDMETHOD. + + METHOD material_missing_raises. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = ` ` quantity = 1 price = 1 ) ). + expect_reason( it_lines = lt_lines + iv_reason = {{p}}provision_calc=>c_material_missing ). + ENDMETHOD. + + METHOD quantity_invalid_raises. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ROPE' quantity = 0 price = 1 ) ). + expect_reason( it_lines = lt_lines + iv_reason = {{p}}provision_calc=>c_quantity_invalid ). + + lt_lines = VALUE #( ( material = 'ROPE' quantity = -1 price = 1 ) ). + expect_reason( it_lines = lt_lines + iv_reason = {{p}}provision_calc=>c_quantity_invalid ). + ENDMETHOD. + + METHOD price_negative_raises. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ROPE' quantity = 1 price = -1 ) ). + expect_reason( it_lines = lt_lines + iv_reason = {{p}}provision_calc=>c_price_negative ). + ENDMETHOD. + + METHOD duplicate_material_raises. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ROPE' quantity = 1 price = 1 ) + ( material = 'ROPE' quantity = 2 price = 1 ) ). + expect_reason( it_lines = lt_lines + iv_reason = {{p}}provision_calc=>c_duplicate_material ). + ENDMETHOD. + + METHOD limit_exceeded_raises. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ENGINE' quantity = 1 price = '100000.01' ) ). + expect_reason( it_lines = lt_lines + iv_reason = {{p}}provision_calc=>c_limit_exceeded ). + ENDMETHOD. + + METHOD limit_boundary_is_ok. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ENGINE' quantity = 1 price = '100000.00' ) ). + TRY. + mo_cut->check_order( lt_lines ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>fail( msg = |Unexpected reason { lx_error->reason }| ). + ENDTRY. + ENDMETHOD. + + METHOD valid_order_is_ok. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ROPE' quantity = 2 price = '3.50' ) + ( material = 'BOLT' quantity = 3 price = '1.25' ) ). + TRY. + mo_cut->check_order( lt_lines ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>fail( msg = |Unexpected reason { lx_error->reason }| ). + ENDTRY. + ENDMETHOD. + + METHOD value_is_sum. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ROPE' quantity = 2 price = '3.50' ) + ( material = 'BOLT' quantity = 3 price = '1.25' ) ). + DATA lv_expected TYPE {{p}}provision_calc=>ty_amount VALUE '10.75'. + DATA lv_value TYPE {{p}}provision_calc=>ty_amount. + TRY. + lv_value = mo_cut->calculate_value( lt_lines ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>fail( msg = |Unexpected reason { lx_error->reason }| ). + ENDTRY. + cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_value ). + ENDMETHOD. + + METHOD value_rounds_total. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ROPE' quantity = '1.005' price = '1.00' ) + ( material = 'BOLT' quantity = '1.005' price = '1.00' ) ). + DATA lv_expected TYPE {{p}}provision_calc=>ty_amount VALUE '2.01'. + DATA lv_value TYPE {{p}}provision_calc=>ty_amount. + TRY. + lv_value = mo_cut->calculate_value( lt_lines ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>fail( msg = |Unexpected reason { lx_error->reason }| ). + ENDTRY. + cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_value ). + ENDMETHOD. + + METHOD invalid_order_propagates. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = '' quantity = 1 price = 1 ) ). + TRY. + mo_cut->calculate_value( lt_lines ). + cl_abap_unit_assert=>fail( msg = 'Expected reason MATERIAL_MISSING' ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>assert_equals( exp = {{p}}provision_calc=>c_material_missing + act = lx_error->reason ). + ENDTRY. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0130/mutation.json b/tasks_gen/eval/G0130/mutation.json new file mode 100644 index 0000000..f210956 --- /dev/null +++ b/tasks_gen/eval/G0130/mutation.json @@ -0,0 +1,66 @@ +{ + "task": "G0130", + "mutants": [ + { + "object": "{{P}}PROVISION_CALC", + "mutant": "line 67: > -> <= (rel)", + "status": "killed", + "hidden": "1/12", + "failed_tests": [ + "DUPLICATE_MATERIAL_RAISES", + "INVALID_ORDER_PROPAGATES", + "LIMIT_BOUNDARY_IS_OK", + "LIMIT_EXCEEDED_RAISES", + "MATERIAL_MISSING_RAISES", + "PRICE_NEGATIVE_RAISES", + "QUANTITY_INVALID_RAISES", + "TOO_MANY_LINES_RAISES", + "VALID_ORDER_IS_OK", + "VALUE_IS_SUM", + "VALUE_ROUNDS_TOTAL" + ] + }, + { + "object": "{{P}}PROVISION_CALC", + "mutant": "line 73: > -> <= (rel)", + "status": "killed", + "hidden": "7/12", + "failed_tests": [ + "LIMIT_BOUNDARY_IS_OK", + "LIMIT_EXCEEDED_RAISES", + "VALID_ORDER_IS_OK", + "VALUE_IS_SUM", + "VALUE_ROUNDS_TOTAL" + ] + }, + { + "object": "{{P}}PROVISION_CALC", + "mutant": "line 95: = -> <> (eq)", + "status": "invalid", + "hidden": "0/0", + "failed_tests": [] + }, + { + "object": "{{P}}PROVISION_CALC", + "mutant": "line 105: + -> - (arith)", + "status": "killed", + "hidden": "9/12", + "failed_tests": [ + "LIMIT_EXCEEDED_RAISES", + "VALUE_IS_SUM", + "VALUE_ROUNDS_TOTAL" + ] + }, + { + "object": "{{P}}PROVISION_CALC", + "mutant": "line 107: 2 -> 3 (const)", + "status": "survived", + "hidden": "12/12", + "failed_tests": [] + } + ], + "valid": 4, + "killed": 3, + "kill_rate": 0.75, + "ok": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0130/reference/cx_presc_error.clas.abap b/tasks_gen/eval/G0130/reference/cx_presc_error.clas.abap deleted file mode 100644 index cd14ebe..0000000 --- a/tasks_gen/eval/G0130/reference/cx_presc_error.clas.abap +++ /dev/null @@ -1,60 +0,0 @@ -CLASS {{p}}cx_presc_error DEFINITION - PUBLIC - INHERITING FROM cx_root - FINAL - CREATE PUBLIC. - - PUBLIC SECTION. - TYPES ty_reason TYPE c LENGTH 12. - - CONSTANTS: - BEGIN OF c_reason, - empty TYPE ty_reason VALUE 'EMPTY', - expired TYPE ty_reason VALUE 'EXPIRED', - quantity TYPE ty_reason VALUE 'QUANTITY', - unknown TYPE ty_reason VALUE 'UNKNOWN', - dose TYPE ty_reason VALUE 'DOSE', - duplicate TYPE ty_reason VALUE 'DUPLICATE', - END OF c_reason. - - METHODS constructor - IMPORTING iv_reason TYPE ty_reason. - - METHODS get_reason - RETURNING VALUE(rv_reason) TYPE ty_reason. - - METHODS get_message_text - RETURNING VALUE(rv_text) TYPE string. - - PRIVATE SECTION. - DATA mv_reason TYPE ty_reason. -ENDCLASS. - - -CLASS {{p}}cx_presc_error IMPLEMENTATION. - METHOD constructor. - super->constructor( ). - mv_reason = iv_reason. - ENDMETHOD. - - METHOD get_reason. - rv_reason = mv_reason. - ENDMETHOD. - - METHOD get_message_text. - CASE mv_reason. - WHEN c_reason-empty. - rv_text = 'The prescription has no items'. - WHEN c_reason-expired. - rv_text = 'The prescription is expired'. - WHEN c_reason-quantity. - rv_text = 'The quantity is not positive'. - WHEN c_reason-unknown. - rv_text = 'The drug is not in the drug master'. - WHEN c_reason-dose. - rv_text = 'The daily dose is not allowed'. - WHEN c_reason-duplicate. - rv_text = 'The drug appears more than once'. - ENDCASE. - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0130/reference/prescription_check.clas.abap b/tasks_gen/eval/G0130/reference/prescription_check.clas.abap deleted file mode 100644 index 1322935..0000000 --- a/tasks_gen/eval/G0130/reference/prescription_check.clas.abap +++ /dev/null @@ -1,103 +0,0 @@ -CLASS {{p}}prescription_check DEFINITION PUBLIC FINAL CREATE PUBLIC. - PUBLIC SECTION. - TYPES ty_drug_id TYPE c LENGTH 10. - - TYPES: - BEGIN OF ty_item, - drug_id TYPE ty_drug_id, - quantity TYPE i, - daily_dose TYPE i, - END OF ty_item, - tt_item TYPE STANDARD TABLE OF ty_item WITH EMPTY KEY. - - METHODS constructor. - - METHODS validate - IMPORTING iv_issue_date TYPE d - iv_valid_days TYPE i - iv_as_of_date TYPE d - it_item TYPE tt_item - RAISING {{p}}cx_presc_error. - - PRIVATE SECTION. - DATA mo_drug_master TYPE REF TO {{p}}drug_master. - - METHODS expiry_date - IMPORTING iv_issue_date TYPE d - iv_valid_days TYPE i - RETURNING VALUE(rv_expiry) TYPE d. - - METHODS check_items - IMPORTING it_item TYPE tt_item - RAISING {{p}}cx_presc_error. - - METHODS check_item - IMPORTING is_item TYPE ty_item - RAISING {{p}}cx_presc_error. - - METHODS check_duplicates - IMPORTING it_item TYPE tt_item - RAISING {{p}}cx_presc_error. -ENDCLASS. - - -CLASS {{p}}prescription_check IMPLEMENTATION. - METHOD constructor. - mo_drug_master = NEW {{p}}drug_master( ). - ENDMETHOD. - - METHOD validate. - IF it_item IS INITIAL. - RAISE EXCEPTION TYPE {{p}}cx_presc_error - EXPORTING iv_reason = {{p}}cx_presc_error=>c_reason-empty. - ENDIF. - - IF iv_as_of_date > expiry_date( iv_issue_date = iv_issue_date - iv_valid_days = iv_valid_days ). - RAISE EXCEPTION TYPE {{p}}cx_presc_error - EXPORTING iv_reason = {{p}}cx_presc_error=>c_reason-expired. - ENDIF. - - check_items( it_item ). - check_duplicates( it_item ). - ENDMETHOD. - - METHOD expiry_date. - rv_expiry = iv_issue_date + iv_valid_days. - ENDMETHOD. - - METHOD check_items. - LOOP AT it_item INTO DATA(ls_item). - check_item( ls_item ). - ENDLOOP. - ENDMETHOD. - - METHOD check_item. - IF is_item-quantity < 1. - RAISE EXCEPTION TYPE {{p}}cx_presc_error - EXPORTING iv_reason = {{p}}cx_presc_error=>c_reason-quantity. - ENDIF. - - DATA(ls_drug) = mo_drug_master->get_drug( is_item-drug_id ). - IF ls_drug IS INITIAL. - RAISE EXCEPTION TYPE {{p}}cx_presc_error - EXPORTING iv_reason = {{p}}cx_presc_error=>c_reason-unknown. - ENDIF. - - IF is_item-daily_dose < 1 OR is_item-daily_dose > ls_drug-max_daily_dose. - RAISE EXCEPTION TYPE {{p}}cx_presc_error - EXPORTING iv_reason = {{p}}cx_presc_error=>c_reason-dose. - ENDIF. - ENDMETHOD. - - METHOD check_duplicates. - DATA lt_seen TYPE HASHED TABLE OF ty_item WITH UNIQUE KEY drug_id. - LOOP AT it_item INTO DATA(ls_item). - INSERT ls_item INTO TABLE lt_seen. - IF sy-subrc <> 0. - RAISE EXCEPTION TYPE {{p}}cx_presc_error - EXPORTING iv_reason = {{p}}cx_presc_error=>c_reason-duplicate. - ENDIF. - ENDLOOP. - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0130/reference/prescription_check.testclasses.abap b/tasks_gen/eval/G0130/reference/prescription_check.testclasses.abap deleted file mode 100644 index eefddd7..0000000 --- a/tasks_gen/eval/G0130/reference/prescription_check.testclasses.abap +++ /dev/null @@ -1,104 +0,0 @@ -CLASS ltc_presc_check DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - DATA mo_cut TYPE REF TO {{p}}prescription_check. - - METHODS setup. - METHODS valid_prescription FOR TESTING. - METHODS empty_prescription FOR TESTING. - METHODS expired_prescription FOR TESTING. - METHODS unknown_drug FOR TESTING. - METHODS bad_quantity FOR TESTING. - METHODS bad_dose FOR TESTING. - METHODS duplicate_drug FOR TESTING. - METHODS message_of_empty FOR TESTING. - - METHODS valid_item - RETURNING VALUE(rt_item) TYPE {{p}}prescription_check=>tt_item. - METHODS expect_reason - IMPORTING iv_reason TYPE {{p}}cx_presc_error=>ty_reason - it_item TYPE {{p}}prescription_check=>tt_item. -ENDCLASS. - - -CLASS ltc_presc_check IMPLEMENTATION. - METHOD setup. - mo_cut = NEW {{p}}prescription_check( ). - ENDMETHOD. - - METHOD valid_item. - rt_item = VALUE #( ( drug_id = 'IBU400' quantity = 10 daily_dose = 1200 ) ). - ENDMETHOD. - - METHOD expect_reason. - DATA lv_raised TYPE abap_bool. - TRY. - mo_cut->validate( iv_issue_date = '20240101' - iv_valid_days = 30 - iv_as_of_date = '20240110' - it_item = it_item ). - CATCH {{p}}cx_presc_error INTO DATA(lx_error). - lv_raised = abap_true. - cl_abap_unit_assert=>assert_equals( exp = iv_reason - act = lx_error->get_reason( ) ). - ENDTRY. - cl_abap_unit_assert=>assert_true( act = lv_raised ). - ENDMETHOD. - - METHOD valid_prescription. - TRY. - mo_cut->validate( iv_issue_date = '20240101' - iv_valid_days = 30 - iv_as_of_date = '20240110' - it_item = valid_item( ) ). - CATCH {{p}}cx_presc_error. - cl_abap_unit_assert=>fail( msg = 'Unexpected exception' ). - ENDTRY. - ENDMETHOD. - - METHOD empty_prescription. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-empty - it_item = VALUE {{p}}prescription_check=>tt_item( ) ). - ENDMETHOD. - - METHOD expired_prescription. - DATA lv_raised TYPE abap_bool. - TRY. - mo_cut->validate( iv_issue_date = '20240101' - iv_valid_days = 30 - iv_as_of_date = '20240201' - it_item = valid_item( ) ). - CATCH {{p}}cx_presc_error INTO DATA(lx_error). - lv_raised = abap_true. - cl_abap_unit_assert=>assert_equals( exp = {{p}}cx_presc_error=>c_reason-expired - act = lx_error->get_reason( ) ). - ENDTRY. - cl_abap_unit_assert=>assert_true( act = lv_raised ). - ENDMETHOD. - - METHOD unknown_drug. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-unknown - it_item = VALUE #( ( drug_id = 'NODRUG' quantity = 5 daily_dose = 10 ) ) ). - ENDMETHOD. - - METHOD bad_quantity. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-quantity - it_item = VALUE #( ( drug_id = 'IBU400' quantity = 0 daily_dose = 1200 ) ) ). - ENDMETHOD. - - METHOD bad_dose. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-dose - it_item = VALUE #( ( drug_id = 'META50' quantity = 5 daily_dose = 500 ) ) ). - ENDMETHOD. - - METHOD duplicate_drug. - expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-duplicate - it_item = VALUE #( ( drug_id = 'IBU400' quantity = 10 daily_dose = 1200 ) - ( drug_id = 'IBU400' quantity = 10 daily_dose = 1200 ) ) ). - ENDMETHOD. - - METHOD message_of_empty. - DATA(lo_error) = NEW {{p}}cx_presc_error( iv_reason = {{p}}cx_presc_error=>c_reason-empty ). - cl_abap_unit_assert=>assert_equals( exp = 'The prescription has no items' - act = lo_error->get_message_text( ) ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0130/reference/provision_calc.clas.abap b/tasks_gen/eval/G0130/reference/provision_calc.clas.abap new file mode 100644 index 0000000..d39795c --- /dev/null +++ b/tasks_gen/eval/G0130/reference/provision_calc.clas.abap @@ -0,0 +1,115 @@ +CLASS {{p}}provision_calc DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES: + ty_material TYPE c LENGTH 18, + ty_quantity TYPE p LENGTH 13 DECIMALS 3, + ty_price TYPE p LENGTH 11 DECIMALS 2, + ty_amount TYPE p LENGTH 13 DECIMALS 2, + ty_reason TYPE c LENGTH 20. + + TYPES: + BEGIN OF ty_line, + material TYPE ty_material, + quantity TYPE ty_quantity, + price TYPE ty_price, + END OF ty_line. + + TYPES tt_lines TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY. + + CONSTANTS: + c_max_lines TYPE i VALUE 999, + c_value_limit TYPE ty_amount VALUE '100000.00', + c_empty_order TYPE ty_reason VALUE 'EMPTY_ORDER', + c_too_many_lines TYPE ty_reason VALUE 'TOO_MANY_LINES', + c_material_missing TYPE ty_reason VALUE 'MATERIAL_MISSING', + c_quantity_invalid TYPE ty_reason VALUE 'QUANTITY_INVALID', + c_price_negative TYPE ty_reason VALUE 'PRICE_NEGATIVE', + c_duplicate_material TYPE ty_reason VALUE 'DUPLICATE_MATERIAL', + c_limit_exceeded TYPE ty_reason VALUE 'LIMIT_EXCEEDED'. + + METHODS constructor. + + METHODS check_order + IMPORTING it_lines TYPE tt_lines + RAISING {{p}}cx_prov_error. + + METHODS calculate_value + IMPORTING it_lines TYPE tt_lines + RETURNING VALUE(rv_value) TYPE ty_amount + RAISING {{p}}cx_prov_error. + + PRIVATE SECTION. + TYPES tt_materials TYPE HASHED TABLE OF ty_material WITH UNIQUE KEY table_line. + + METHODS check_lines + IMPORTING it_lines TYPE tt_lines + RAISING {{p}}cx_prov_error. + + METHODS total_value + IMPORTING it_lines TYPE tt_lines + RETURNING VALUE(rv_value) TYPE ty_amount. + + METHODS raise_error + IMPORTING iv_reason TYPE ty_reason + RAISING {{p}}cx_prov_error. +ENDCLASS. + + +CLASS {{p}}provision_calc IMPLEMENTATION. + METHOD constructor. + ENDMETHOD. + + METHOD check_order. + IF it_lines IS INITIAL. + raise_error( c_empty_order ). + ENDIF. + + IF lines( it_lines ) > c_max_lines. + raise_error( c_too_many_lines ). + ENDIF. + + check_lines( it_lines ). + + IF total_value( it_lines ) > c_value_limit. + raise_error( c_limit_exceeded ). + ENDIF. + ENDMETHOD. + + METHOD calculate_value. + check_order( it_lines ). + rv_value = total_value( it_lines ). + ENDMETHOD. + + METHOD check_lines. + DATA lt_seen TYPE tt_materials. + LOOP AT it_lines INTO DATA(ls_line). + IF ls_line-material IS INITIAL. + raise_error( c_material_missing ). + ENDIF. + IF ls_line-quantity <= 0. + raise_error( c_quantity_invalid ). + ENDIF. + IF ls_line-price < 0. + raise_error( c_price_negative ). + ENDIF. + IF line_exists( lt_seen[ table_line = ls_line-material ] ). + raise_error( c_duplicate_material ). + ENDIF. + INSERT ls_line-material INTO TABLE lt_seen. + ENDLOOP. + ENDMETHOD. + + METHOD total_value. + DATA lv_total TYPE p LENGTH 16 DECIMALS 5. + LOOP AT it_lines INTO DATA(ls_line). + lv_total = lv_total + ls_line-quantity * ls_line-price. + ENDLOOP. + rv_value = round( val = lv_total dec = 2 ). + ENDMETHOD. + + METHOD raise_error. + RAISE EXCEPTION TYPE {{p}}cx_prov_error + EXPORTING + iv_reason = iv_reason. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0130/reference/provision_calc.testclasses.abap b/tasks_gen/eval/G0130/reference/provision_calc.testclasses.abap new file mode 100644 index 0000000..d60282b --- /dev/null +++ b/tasks_gen/eval/G0130/reference/provision_calc.testclasses.abap @@ -0,0 +1,95 @@ +CLASS ltc_provision_calc DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + DATA mo_cut TYPE REF TO {{p}}provision_calc. + + METHODS setup. + METHODS empty_order FOR TESTING. + METHODS material_missing FOR TESTING. + METHODS duplicate_material FOR TESTING. + METHODS value_of_valid_order FOR TESTING. + METHODS limit_exceeded FOR TESTING. + METHODS rounds_total FOR TESTING. +ENDCLASS. + + +CLASS ltc_provision_calc IMPLEMENTATION. + METHOD setup. + mo_cut = NEW {{p}}provision_calc( ). + ENDMETHOD. + + METHOD empty_order. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + TRY. + mo_cut->check_order( lt_lines ). + cl_abap_unit_assert=>fail( ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>assert_equals( exp = {{p}}provision_calc=>c_empty_order + act = lx_error->reason ). + ENDTRY. + ENDMETHOD. + + METHOD material_missing. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = ` ` quantity = 1 price = 1 ) ). + TRY. + mo_cut->check_order( lt_lines ). + cl_abap_unit_assert=>fail( ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>assert_equals( exp = {{p}}provision_calc=>c_material_missing + act = lx_error->reason ). + ENDTRY. + ENDMETHOD. + + METHOD duplicate_material. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ROPE' quantity = 1 price = 1 ) + ( material = 'ROPE' quantity = 2 price = 1 ) ). + TRY. + mo_cut->check_order( lt_lines ). + cl_abap_unit_assert=>fail( ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>assert_equals( exp = {{p}}provision_calc=>c_duplicate_material + act = lx_error->reason ). + ENDTRY. + ENDMETHOD. + + METHOD value_of_valid_order. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ROPE' quantity = 2 price = '3.50' ) + ( material = 'BOLT' quantity = 3 price = '1.25' ) ). + DATA lv_expected TYPE {{p}}provision_calc=>ty_amount VALUE '10.75'. + DATA lv_value TYPE {{p}}provision_calc=>ty_amount. + TRY. + lv_value = mo_cut->calculate_value( lt_lines ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>fail( msg = |Unexpected reason { lx_error->reason }| ). + ENDTRY. + cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_value ). + ENDMETHOD. + + METHOD limit_exceeded. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ENGINE' quantity = 1 price = '100000.01' ) ). + TRY. + mo_cut->check_order( lt_lines ). + cl_abap_unit_assert=>fail( ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>assert_equals( exp = {{p}}provision_calc=>c_limit_exceeded + act = lx_error->reason ). + ENDTRY. + ENDMETHOD. + + METHOD rounds_total. + DATA lt_lines TYPE {{p}}provision_calc=>tt_lines. + lt_lines = VALUE #( ( material = 'ROPE' quantity = '1.005' price = '1.00' ) + ( material = 'BOLT' quantity = '1.005' price = '1.00' ) ). + DATA lv_expected TYPE {{p}}provision_calc=>ty_amount VALUE '2.01'. + DATA lv_value TYPE {{p}}provision_calc=>ty_amount. + TRY. + lv_value = mo_cut->calculate_value( lt_lines ). + CATCH {{p}}cx_prov_error INTO DATA(lx_error). + cl_abap_unit_assert=>fail( msg = |Unexpected reason { lx_error->reason }| ). + ENDTRY. + cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_value ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0130/seed/cx_prov_error.clas.abap b/tasks_gen/eval/G0130/seed/cx_prov_error.clas.abap new file mode 100644 index 0000000..870d6b2 --- /dev/null +++ b/tasks_gen/eval/G0130/seed/cx_prov_error.clas.abap @@ -0,0 +1,19 @@ +CLASS {{p}}cx_prov_error DEFINITION PUBLIC INHERITING FROM cx_static_check FINAL CREATE PUBLIC. + PUBLIC SECTION. + TYPES ty_reason TYPE c LENGTH 20. + + DATA reason TYPE ty_reason READ-ONLY. + + METHODS constructor + IMPORTING iv_reason TYPE ty_reason. + + PRIVATE SECTION. +ENDCLASS. + + +CLASS {{p}}cx_prov_error IMPLEMENTATION. + METHOD constructor. + super->constructor( ). + reason = iv_reason. + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0130/seed/drug_master.clas.abap b/tasks_gen/eval/G0130/seed/drug_master.clas.abap deleted file mode 100644 index ee82309..0000000 --- a/tasks_gen/eval/G0130/seed/drug_master.clas.abap +++ /dev/null @@ -1,38 +0,0 @@ -CLASS {{p}}drug_master DEFINITION PUBLIC FINAL CREATE PUBLIC. - PUBLIC SECTION. - TYPES ty_drug_id TYPE c LENGTH 10. - - TYPES: - BEGIN OF ty_drug, - drug_id TYPE ty_drug_id, - max_daily_dose TYPE i, - END OF ty_drug, - tt_drug TYPE STANDARD TABLE OF ty_drug WITH EMPTY KEY. - - METHODS get_drug - IMPORTING iv_drug_id TYPE ty_drug_id - RETURNING VALUE(rs_drug) TYPE ty_drug. - - PRIVATE SECTION. - METHODS get_all_drugs - RETURNING VALUE(rt_drug) TYPE tt_drug. -ENDCLASS. - - -CLASS {{p}}drug_master IMPLEMENTATION. - METHOD get_drug. - DATA(lt_drug) = get_all_drugs( ). - READ TABLE lt_drug INTO rs_drug WITH KEY drug_id = iv_drug_id. - IF sy-subrc <> 0. - CLEAR rs_drug. - ENDIF. - ENDMETHOD. - - METHOD get_all_drugs. - rt_drug = VALUE #( ( drug_id = 'PARA500' max_daily_dose = 4000 ) - ( drug_id = 'IBU400' max_daily_dose = 1200 ) - ( drug_id = 'AMOX500' max_daily_dose = 1500 ) - ( drug_id = 'META50' max_daily_dose = 200 ) - ( drug_id = 'SALB100' max_daily_dose = 800 ) ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0130/spec.md b/tasks_gen/eval/G0130/spec.md index eb4cad6..216c1d4 100644 --- a/tasks_gen/eval/G0130/spec.md +++ b/tasks_gen/eval/G0130/spec.md @@ -1,84 +1,73 @@ # 1. Goal -A pharmacy dispenses prescription items. Before the pharmacy dispenses a -prescription, it validates the prescription. The validation raises a class-based -exception with one reason and one message for each problem. The pharmacy program -needs the validation class and the exception class. +A ship chandler supplies provisions to vessels. The ordering program of the +chandler calls one service for each provisioning order. The service checks the +lines of the order and calculates the net value of the order. The service +reports each violation as a class-based exception with one reason code. # 2. Open questions None. # 3. Context -- The class {{P}}DRUG_MASTER is in package $TMP. It is active. It is the drug - master data of the pharmacy. Do not change it. - - Public type TY_DRUG_ID: character, length 10. - - Public structure TY_DRUG with the components DRUG_ID (TY_DRUG_ID) and - MAX_DAILY_DOSE (integer, milligram). - - Public method GET_DRUG with the importing parameter IV_DRUG_ID (TY_DRUG_ID) - and the returning parameter RS_DRUG (TY_DRUG). If the drug is not in the - master data, RS_DRUG is initial. -- The drug master data contains these drugs and maximum daily doses: - PARA500 4000, IBU400 1200, AMOX500 1500, META50 200, SALB100 800. -- A prescription has an issue date, a number of valid days and items. Each item - has a drug, a quantity and a daily dose. +- The exception class {{P}}CX_PROV_ERROR exists in package $TMP. It is active. +- The class inherits from CX_STATIC_CHECK. It has the type TY_REASON (CHAR 20), + the read-only attribute REASON, and a constructor with the importing + parameter IV_REASON of type TY_REASON. +- The ordering program catches the exception and shows the reason code. # 4. Contract -## 4.1 Exception class {{P}}CX_PRESC_ERROR -- Create the class in package $TMP. -- The class inherits from CX_ROOT. -- Public type TY_REASON: character, length 12. -- Public constant structure C_REASON with the components EMPTY, EXPIRED, - QUANTITY, UNKNOWN, DOSE and DUPLICATE. Each component has the type TY_REASON - and the value of its own name. -- Public constructor with the importing parameter IV_REASON (TY_REASON). -- Public method GET_REASON with the returning parameter RV_REASON (TY_REASON). -- Public method GET_MESSAGE_TEXT with the returning parameter RV_TEXT (string). - GET_MESSAGE_TEXT returns the message of the reason: - - EMPTY: The prescription has no items - - EXPIRED: The prescription is expired - - QUANTITY: The quantity is not positive - - UNKNOWN: The drug is not in the drug master - - DOSE: The daily dose is not allowed - - DUPLICATE: The drug appears more than once - -## 4.2 Check class {{P}}PRESCRIPTION_CHECK -- Create the class in package $TMP. +- Create the class {{P}}PROVISION_CALC in package $TMP. - The class is public and final. It has a public constructor without parameters. -- Public type TY_DRUG_ID: character, length 10. -- Public structure TY_ITEM with the components DRUG_ID (TY_DRUG_ID), QUANTITY - (integer) and DAILY_DOSE (integer). -- Public table type TT_ITEM: standard table of TY_ITEM with empty key. -- Public method VALIDATE with these importing parameters: - - IV_ISSUE_DATE (type d) - - IV_VALID_DAYS (integer) - - IV_AS_OF_DATE (type d) - - IT_ITEM (TT_ITEM) - and the addition RAISING {{P}}CX_PRESC_ERROR. +- Public types of the class: + - TY_MATERIAL (CHAR 18), TY_QUANTITY (packed, length 13, 3 decimals), + TY_PRICE (packed, length 11, 2 decimals), TY_AMOUNT (packed, length 13, + 2 decimals), TY_REASON (CHAR 20). + - TY_LINE with the components MATERIAL, QUANTITY and PRICE. + - TT_LINES, a standard table of TY_LINE with an empty key. +- Public constants of the class: + - C_MAX_LINES (type I) with the value 999. + - C_VALUE_LIMIT (type TY_AMOUNT) with the value 100000.00. + - C_EMPTY_ORDER, C_TOO_MANY_LINES, C_MATERIAL_MISSING, C_QUANTITY_INVALID, + C_PRICE_NEGATIVE, C_DUPLICATE_MATERIAL and C_LIMIT_EXCEEDED, all of type + TY_REASON, with the values EMPTY_ORDER, TOO_MANY_LINES, MATERIAL_MISSING, + QUANTITY_INVALID, PRICE_NEGATIVE, DUPLICATE_MATERIAL and LIMIT_EXCEEDED. +- Public methods of the class: + - CHECK_ORDER, importing IT_LINES of type TT_LINES, raising + {{P}}CX_PROV_ERROR. + - CALCULATE_VALUE, importing IT_LINES of type TT_LINES, returning RV_VALUE + of type TY_AMOUNT, raising {{P}}CX_PROV_ERROR. - Do not add other public methods. # 5. Business rules -VALIDATE applies the rules in this sequence. It raises {{P}}CX_PRESC_ERROR with -the reason of the first rule that fails. -1. If IT_ITEM is empty, the reason is EMPTY. -2. If IV_AS_OF_DATE is later than IV_ISSUE_DATE plus IV_VALID_DAYS days, the - reason is EXPIRED. -3. Process the items in the sequence of the table. For each item: - 3.1 If QUANTITY is less than 1, the reason is QUANTITY. - 3.2 If DRUG_ID is not in the drug master data, the reason is UNKNOWN. - 3.3 If DAILY_DOSE is less than 1, or if DAILY_DOSE is greater than the - maximum daily dose of the drug, the reason is DOSE. -4. If one DRUG_ID occurs in more than one item, the reason is DUPLICATE. -5. Else VALIDATE returns without an exception. -The dates are always valid dates. +The value of a line is the quantity multiplied by the price. The net value of +the order is the sum of the exact line values. Round only the net value, and +only once, to 2 decimals. Half values round away from zero. + +CHECK_ORDER applies these rules in this sequence. It raises {{P}}CX_PROV_ERROR +with the reason of the first rule that fails. +1. If the order has no line, the reason is C_EMPTY_ORDER. +2. If the order has more than C_MAX_LINES lines, the reason is + C_TOO_MANY_LINES. +3. Check the lines in the given order. For each line apply these rules in this + sequence: + a. If the material is empty or contains only spaces, the reason is + C_MATERIAL_MISSING. + b. If the quantity is not greater than zero, the reason is + C_QUANTITY_INVALID. + c. If the price is less than zero, the reason is C_PRICE_NEGATIVE. + d. If the material occurs in an earlier line, the reason is + C_DUPLICATE_MATERIAL. +4. If the net value of the order is greater than C_VALUE_LIMIT, the reason is + C_LIMIT_EXCEEDED. + +CALCULATE_VALUE applies the same checks and returns the net value. # 6. Constraints -- Release target: SAP_BASIS 816 (ABAP Platform 2025). -- Package: $TMP. Do not use a transport request. -- Coding standards: Clean ABAP. Methods below 40 statements. No global - variables. Pass large parameters by reference. No comment that restates the - code. -- Out of scope: do not change {{P}}DRUG_MASTER. +- Release target: SAP_BASIS 8.16. +- Coding standards: Clean ABAP. Method length below 40 statements. No global + variables. No comment that restates the code. +- Out of scope: do not change {{P}}CX_PROV_ERROR. # 7. Acceptance -- Both classes are active and have no syntax error. +- The class is active and has no syntax error. - The hidden tests pass. -- Write your own ABAP Unit tests for {{P}}PRESCRIPTION_CHECK. +- Write your own ABAP Unit tests for the class. diff --git a/tasks_gen/eval/G0130/task.json b/tasks_gen/eval/G0130/task.json index 39d1967..9d0c47e 100644 --- a/tasks_gen/eval/G0130/task.json +++ b/tasks_gen/eval/G0130/task.json @@ -12,49 +12,39 @@ "seed": [ { "type": "CLAS", - "name": "{{P}}DRUG_MASTER", - "file": "seed/drug_master.clas.abap", - "description": "Drug master data of the pharmacy" + "name": "{{P}}CX_PROV_ERROR", + "file": "seed/cx_prov_error.clas.abap", + "description": "Class-based exception that carries one provisioning reason code" } ], "contract": [ { "type": "CLAS", - "name": "{{P}}CX_PRESC_ERROR" - }, - { - "type": "CLAS", - "name": "{{P}}PRESCRIPTION_CHECK" + "name": "{{P}}PROVISION_CALC" } ], "out_of_scope": [ - "{{P}}DRUG_MASTER" + "{{P}}CX_PROV_ERROR" ], "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}T02_HIDDEN", - "file": "hidden/t02_hidden.clas.abap", - "description": "T02 hidden tests" + "name": "{{P}}T_PROV_HIDDEN", + "file": "hidden/t_prov_hidden.clas.abap", + "description": "Hidden tests for the provisioning order service" } ], "reference": [ { "type": "CLAS", - "name": "{{P}}CX_PRESC_ERROR", - "file": "reference/cx_presc_error.clas.abap", - "description": "Prescription exception with reason and message" - }, - { - "type": "CLAS", - "name": "{{P}}PRESCRIPTION_CHECK", - "file": "reference/prescription_check.clas.abap", - "description": "Prescription check", - "testclasses_file": "reference/prescription_check.testclasses.abap" + "name": "{{P}}PROVISION_CALC", + "file": "reference/provision_calc.clas.abap", + "description": "Provisioning order check and net value calculation", + "testclasses_file": "reference/provision_calc.testclasses.abap" } ], "craft_checks": [ "method_length", - "db_operation_in_loop" + "exception_handling" ] } \ No newline at end of file diff --git a/tasks_gen/eval/G0131/empirical.json b/tasks_gen/eval/G0131/empirical.json new file mode 100644 index 0000000..1fbaf35 --- /dev/null +++ b/tasks_gen/eval/G0131/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 95.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 5.0, + "total": 95.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 26, + "seconds": 718.5, + "run_dir": "runs/emp/10044_G0131_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0131/review.json b/tasks_gen/eval/G0131/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0131/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0132/empirical.json b/tasks_gen/eval/G0132/empirical.json new file mode 100644 index 0000000..fe9f868 --- /dev/null +++ b/tasks_gen/eval/G0132/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 27, + "seconds": 129.4, + "run_dir": "runs/emp/10045_G0132_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0132/review.json b/tasks_gen/eval/G0132/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0132/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0133/empirical.json b/tasks_gen/eval/G0133/empirical.json new file mode 100644 index 0000000..6d40b36 --- /dev/null +++ b/tasks_gen/eval/G0133/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 23, + "seconds": 79.7, + "run_dir": "runs/emp/10046_G0133_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0133/review.json b/tasks_gen/eval/G0133/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0133/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0134/empirical.json b/tasks_gen/eval/G0134/empirical.json new file mode 100644 index 0000000..a35d6e7 --- /dev/null +++ b/tasks_gen/eval/G0134/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 33, + "seconds": 207.8, + "run_dir": "runs/emp/10047_G0134_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0134/review.json b/tasks_gen/eval/G0134/review.json new file mode 100644 index 0000000..17ebd6d --- /dev/null +++ b/tasks_gen/eval/G0134/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Survived bool on initial value: assignment is overwritten on the tested paths.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0135/empirical.json b/tasks_gen/eval/G0135/empirical.json new file mode 100644 index 0000000..9797f8c --- /dev/null +++ b/tasks_gen/eval/G0135/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "12/12", + "tool_calls": 6, + "seconds": 32.2, + "run_dir": "runs/emp/10048_G0135_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0135/review.json b/tasks_gen/eval/G0135/review.json new file mode 100644 index 0000000..fe0e613 --- /dev/null +++ b/tasks_gen/eval/G0135/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Survived * -> / : equivalent for the tested block fee.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0136/empirical.json b/tasks_gen/eval/G0136/empirical.json new file mode 100644 index 0000000..c3f1c28 --- /dev/null +++ b/tasks_gen/eval/G0136/empirical.json @@ -0,0 +1,16 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "failed_gates": [ + "G2_contract", + "G3_hidden_runs" + ] + }, + "hidden": "0/0", + "tool_calls": 8, + "seconds": 682.7, + "run_dir": "runs/emp/10049_G0136_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0136/review.json b/tasks_gen/eval/G0136/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0136/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0137/empirical.json b/tasks_gen/eval/G0137/empirical.json new file mode 100644 index 0000000..5eee9e4 --- /dev/null +++ b/tasks_gen/eval/G0137/empirical.json @@ -0,0 +1,17 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "failed_gates": [ + "G1_active", + "G2_contract", + "G3_hidden_runs" + ] + }, + "hidden": "0/0", + "tool_calls": 6, + "seconds": 580.1, + "run_dir": "runs/emp/10050_G0137_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0137/review.json b/tasks_gen/eval/G0137/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0137/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0138/empirical.json b/tasks_gen/eval/G0138/empirical.json new file mode 100644 index 0000000..d55681b --- /dev/null +++ b/tasks_gen/eval/G0138/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 8, + "seconds": 92.3, + "run_dir": "runs/emp/10051_G0138_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0138/review.json b/tasks_gen/eval/G0138/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0138/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0139/empirical.json b/tasks_gen/eval/G0139/empirical.json new file mode 100644 index 0000000..116f91e --- /dev/null +++ b/tasks_gen/eval/G0139/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 11, + "seconds": 102.2, + "run_dir": "runs/emp/10052_G0139_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0139/review.json b/tasks_gen/eval/G0139/review.json new file mode 100644 index 0000000..ebc3eea --- /dev/null +++ b/tasks_gen/eval/G0139/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Survived mutant: round dec +1, equivalent (result field has fewer decimals).", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0140/empirical.json b/tasks_gen/eval/G0140/empirical.json new file mode 100644 index 0000000..1f9dbfd --- /dev/null +++ b/tasks_gen/eval/G0140/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "7/7", + "tool_calls": 28, + "seconds": 362.5, + "run_dir": "runs/emp/11013_G0140_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0140/review.json b/tasks_gen/eval/G0140/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0140/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0141/faulty/m0_helpdesk_old.prog.abap b/tasks_gen/eval/G0141/faulty/m0_helpdesk_old.prog.abap new file mode 100644 index 0000000..5a9013f --- /dev/null +++ b/tasks_gen/eval/G0141/faulty/m0_helpdesk_old.prog.abap @@ -0,0 +1,160 @@ +REPORT {{p}}helpdesk_old. + +DATA gv_team TYPE {{p}}ticket-team. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_team FOR gv_team. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_line, + team TYPE {{p}}ticket-team, + tickets TYPE i, + urgent TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_team TYPE RANGE OF {{p}}ticket-team. + TYPES: + BEGIN OF ty_group, + team TYPE {{p}}ticket-team, + priority TYPE {{p}}ticket-priority, + cnt TYPE i, + END OF ty_group, + tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY. + + METHODS select_teams + IMPORTING iv_from TYPE d + iv_to TYPE d + it_team TYPE tt_team + RETURNING VALUE(rt_line) TYPE tt_line. + + METHODS display + CHANGING ct_line TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_teams. + SELECT team, priority, COUNT(*) AS cnt + FROM {{p}}ticket + WHERE opened_on >= @iv_from + OR opened_on <= @iv_to + AND team IN @it_team + GROUP BY team, priority + INTO TABLE @DATA(lt_group). + + SORT lt_group BY team. + + DATA ls_line TYPE ty_line. + DATA lv_first TYPE abap_bool VALUE abap_true. + LOOP AT lt_group INTO DATA(ls_group). + IF lv_first = abap_false AND ls_line-team <> ls_group-team. + APPEND ls_line TO rt_line. + CLEAR ls_line. + ENDIF. + lv_first = abap_false. + ls_line-team = ls_group-team. + ls_line-tickets = ls_line-tickets + ls_group-cnt. + IF ls_group-priority = '1' OR ls_group-priority = '2'. + ls_line-urgent = ls_line-urgent + ls_group-cnt. + ENDIF. + ENDLOOP. + IF lv_first = abap_false. + APPEND ls_line TO rt_line. + ENDIF. + + SORT rt_line BY tickets DESCENDING team ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_line ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ). + go_report->display( CHANGING ct_line = gt_line ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS setup. + METHODS counts_per_team FOR TESTING. + METHODS urgent_rule FOR TESTING. + METHODS date_filter FOR TESTING. + METHODS team_filter FOR TESTING. + METHODS sorted_by_tickets FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD setup. + go_env->clear_doubles( ). + DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY. + lt_ticket = VALUE #( + ( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' ) + ( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' ) + ( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' ) + ( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' ) + ( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' ) + ( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ). + go_env->insert_test_data( lt_ticket ). + ENDMETHOD. + + METHOD counts_per_team. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD urgent_rule. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD date_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD team_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' + it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD sorted_by_tickets. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0141/faulty/m1_helpdesk_old.prog.abap b/tasks_gen/eval/G0141/faulty/m1_helpdesk_old.prog.abap new file mode 100644 index 0000000..5e7b5dd --- /dev/null +++ b/tasks_gen/eval/G0141/faulty/m1_helpdesk_old.prog.abap @@ -0,0 +1,160 @@ +REPORT {{p}}helpdesk_old. + +DATA gv_team TYPE {{p}}ticket-team. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_team FOR gv_team. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_line, + team TYPE {{p}}ticket-team, + tickets TYPE i, + urgent TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_team TYPE RANGE OF {{p}}ticket-team. + TYPES: + BEGIN OF ty_group, + team TYPE {{p}}ticket-team, + priority TYPE {{p}}ticket-priority, + cnt TYPE i, + END OF ty_group, + tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY. + + METHODS select_teams + IMPORTING iv_from TYPE d + iv_to TYPE d + it_team TYPE tt_team + RETURNING VALUE(rt_line) TYPE tt_line. + + METHODS display + CHANGING ct_line TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_teams. + SELECT team, priority, COUNT(*) AS cnt + FROM {{p}}ticket + WHERE opened_on >= @iv_from + AND opened_on <= @iv_to + AND team IN @it_team + GROUP BY team, priority + INTO TABLE @DATA(lt_group). + + SORT lt_group BY team. + + DATA ls_line TYPE ty_line. + DATA lv_first TYPE abap_bool VALUE abap_true. + LOOP AT lt_group INTO DATA(ls_group). + IF lv_first = abap_false AND ls_line-team = ls_group-team. + APPEND ls_line TO rt_line. + CLEAR ls_line. + ENDIF. + lv_first = abap_false. + ls_line-team = ls_group-team. + ls_line-tickets = ls_line-tickets + ls_group-cnt. + IF ls_group-priority = '1' OR ls_group-priority = '2'. + ls_line-urgent = ls_line-urgent + ls_group-cnt. + ENDIF. + ENDLOOP. + IF lv_first = abap_false. + APPEND ls_line TO rt_line. + ENDIF. + + SORT rt_line BY tickets DESCENDING team ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_line ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ). + go_report->display( CHANGING ct_line = gt_line ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS setup. + METHODS counts_per_team FOR TESTING. + METHODS urgent_rule FOR TESTING. + METHODS date_filter FOR TESTING. + METHODS team_filter FOR TESTING. + METHODS sorted_by_tickets FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD setup. + go_env->clear_doubles( ). + DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY. + lt_ticket = VALUE #( + ( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' ) + ( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' ) + ( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' ) + ( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' ) + ( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' ) + ( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ). + go_env->insert_test_data( lt_ticket ). + ENDMETHOD. + + METHOD counts_per_team. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD urgent_rule. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD date_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD team_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' + it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD sorted_by_tickets. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0141/faulty/m2_helpdesk_old.prog.abap b/tasks_gen/eval/G0141/faulty/m2_helpdesk_old.prog.abap new file mode 100644 index 0000000..438c810 --- /dev/null +++ b/tasks_gen/eval/G0141/faulty/m2_helpdesk_old.prog.abap @@ -0,0 +1,160 @@ +REPORT {{p}}helpdesk_old. + +DATA gv_team TYPE {{p}}ticket-team. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_team FOR gv_team. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_line, + team TYPE {{p}}ticket-team, + tickets TYPE i, + urgent TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_team TYPE RANGE OF {{p}}ticket-team. + TYPES: + BEGIN OF ty_group, + team TYPE {{p}}ticket-team, + priority TYPE {{p}}ticket-priority, + cnt TYPE i, + END OF ty_group, + tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY. + + METHODS select_teams + IMPORTING iv_from TYPE d + iv_to TYPE d + it_team TYPE tt_team + RETURNING VALUE(rt_line) TYPE tt_line. + + METHODS display + CHANGING ct_line TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_teams. + SELECT team, priority, COUNT(*) AS cnt + FROM {{p}}ticket + WHERE opened_on >= @iv_from + AND opened_on <= @iv_to + AND team IN @it_team + GROUP BY team, priority + INTO TABLE @DATA(lt_group). + + SORT lt_group BY team. + + DATA ls_line TYPE ty_line. + DATA lv_first TYPE abap_bool VALUE abap_true. + LOOP AT lt_group INTO DATA(ls_group). + IF lv_first = abap_false AND ls_line-team <> ls_group-team. + APPEND ls_line TO rt_line. + CLEAR ls_line. + ENDIF. + lv_first = abap_true. + ls_line-team = ls_group-team. + ls_line-tickets = ls_line-tickets + ls_group-cnt. + IF ls_group-priority = '1' OR ls_group-priority = '2'. + ls_line-urgent = ls_line-urgent + ls_group-cnt. + ENDIF. + ENDLOOP. + IF lv_first = abap_false. + APPEND ls_line TO rt_line. + ENDIF. + + SORT rt_line BY tickets DESCENDING team ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_line ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ). + go_report->display( CHANGING ct_line = gt_line ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS setup. + METHODS counts_per_team FOR TESTING. + METHODS urgent_rule FOR TESTING. + METHODS date_filter FOR TESTING. + METHODS team_filter FOR TESTING. + METHODS sorted_by_tickets FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD setup. + go_env->clear_doubles( ). + DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY. + lt_ticket = VALUE #( + ( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' ) + ( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' ) + ( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' ) + ( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' ) + ( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' ) + ( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ). + go_env->insert_test_data( lt_ticket ). + ENDMETHOD. + + METHOD counts_per_team. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD urgent_rule. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD date_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD team_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' + it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD sorted_by_tickets. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0141/faulty/m3_helpdesk_old.prog.abap b/tasks_gen/eval/G0141/faulty/m3_helpdesk_old.prog.abap new file mode 100644 index 0000000..01656c5 --- /dev/null +++ b/tasks_gen/eval/G0141/faulty/m3_helpdesk_old.prog.abap @@ -0,0 +1,160 @@ +REPORT {{p}}helpdesk_old. + +DATA gv_team TYPE {{p}}ticket-team. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_team FOR gv_team. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_line, + team TYPE {{p}}ticket-team, + tickets TYPE i, + urgent TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_team TYPE RANGE OF {{p}}ticket-team. + TYPES: + BEGIN OF ty_group, + team TYPE {{p}}ticket-team, + priority TYPE {{p}}ticket-priority, + cnt TYPE i, + END OF ty_group, + tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY. + + METHODS select_teams + IMPORTING iv_from TYPE d + iv_to TYPE d + it_team TYPE tt_team + RETURNING VALUE(rt_line) TYPE tt_line. + + METHODS display + CHANGING ct_line TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_teams. + SELECT team, priority, COUNT(*) AS cnt + FROM {{p}}ticket + WHERE opened_on >= @iv_from + AND opened_on <= @iv_to + AND team IN @it_team + GROUP BY team, priority + INTO TABLE @DATA(lt_group). + + SORT lt_group BY team. + + DATA ls_line TYPE ty_line. + DATA lv_first TYPE abap_bool VALUE abap_true. + LOOP AT lt_group INTO DATA(ls_group). + IF lv_first = abap_false AND ls_line-team <> ls_group-team. + APPEND ls_line TO rt_line. + CLEAR ls_line. + ENDIF. + lv_first = abap_false. + ls_line-team = ls_group-team. + ls_line-tickets = ls_line-tickets + ls_group-cnt. + IF ls_group-priority <> '1' OR ls_group-priority = '2'. + ls_line-urgent = ls_line-urgent + ls_group-cnt. + ENDIF. + ENDLOOP. + IF lv_first = abap_false. + APPEND ls_line TO rt_line. + ENDIF. + + SORT rt_line BY tickets DESCENDING team ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_line ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ). + go_report->display( CHANGING ct_line = gt_line ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS setup. + METHODS counts_per_team FOR TESTING. + METHODS urgent_rule FOR TESTING. + METHODS date_filter FOR TESTING. + METHODS team_filter FOR TESTING. + METHODS sorted_by_tickets FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD setup. + go_env->clear_doubles( ). + DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY. + lt_ticket = VALUE #( + ( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' ) + ( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' ) + ( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' ) + ( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' ) + ( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' ) + ( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ). + go_env->insert_test_data( lt_ticket ). + ENDMETHOD. + + METHOD counts_per_team. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD urgent_rule. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD date_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD team_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' + it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD sorted_by_tickets. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0141/faulty/m4_helpdesk_old.prog.abap b/tasks_gen/eval/G0141/faulty/m4_helpdesk_old.prog.abap new file mode 100644 index 0000000..3eaabc3 --- /dev/null +++ b/tasks_gen/eval/G0141/faulty/m4_helpdesk_old.prog.abap @@ -0,0 +1,160 @@ +REPORT {{p}}helpdesk_old. + +DATA gv_team TYPE {{p}}ticket-team. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_team FOR gv_team. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_line, + team TYPE {{p}}ticket-team, + tickets TYPE i, + urgent TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_team TYPE RANGE OF {{p}}ticket-team. + TYPES: + BEGIN OF ty_group, + team TYPE {{p}}ticket-team, + priority TYPE {{p}}ticket-priority, + cnt TYPE i, + END OF ty_group, + tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY. + + METHODS select_teams + IMPORTING iv_from TYPE d + iv_to TYPE d + it_team TYPE tt_team + RETURNING VALUE(rt_line) TYPE tt_line. + + METHODS display + CHANGING ct_line TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_teams. + SELECT team, priority, COUNT(*) AS cnt + FROM {{p}}ticket + WHERE opened_on >= @iv_from + AND opened_on <= @iv_to + AND team IN @it_team + GROUP BY team, priority + INTO TABLE @DATA(lt_group). + + SORT lt_group BY team. + + DATA ls_line TYPE ty_line. + DATA lv_first TYPE abap_bool VALUE abap_true. + LOOP AT lt_group INTO DATA(ls_group). + IF lv_first = abap_false AND ls_line-team <> ls_group-team. + APPEND ls_line TO rt_line. + CLEAR ls_line. + ENDIF. + lv_first = abap_false. + ls_line-team = ls_group-team. + ls_line-tickets = ls_line-tickets + ls_group-cnt. + IF ls_group-priority = '1' OR ls_group-priority = '2'. + ls_line-urgent = ls_line-urgent - ls_group-cnt. + ENDIF. + ENDLOOP. + IF lv_first = abap_false. + APPEND ls_line TO rt_line. + ENDIF. + + SORT rt_line BY tickets DESCENDING team ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_line ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ). + go_report->display( CHANGING ct_line = gt_line ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS setup. + METHODS counts_per_team FOR TESTING. + METHODS urgent_rule FOR TESTING. + METHODS date_filter FOR TESTING. + METHODS team_filter FOR TESTING. + METHODS sorted_by_tickets FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD setup. + go_env->clear_doubles( ). + DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY. + lt_ticket = VALUE #( + ( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' ) + ( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' ) + ( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' ) + ( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' ) + ( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' ) + ( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ). + go_env->insert_test_data( lt_ticket ). + ENDMETHOD. + + METHOD counts_per_team. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD urgent_rule. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD date_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD team_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' + it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD sorted_by_tickets. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0141/generation.json b/tasks_gen/eval/G0141/generation.json new file mode 100644 index 0000000..3cb4f5c --- /dev/null +++ b/tasks_gen/eval/G0141/generation.json @@ -0,0 +1,24 @@ +{ + "id": "G0141", + "pool": "eval", + "object_type": "PROG", + "category": "E", + "attempts": [ + { + "stage": "validate", + "oracle": 85.0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 100.0, + "null": 0, + "mutation": { + "valid": 5, + "killed": 5, + "ok": true + } + } + ], + "accepted": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0141/hidden/news_dist_hidden.clas.abap b/tasks_gen/eval/G0141/hidden/news_dist_hidden.clas.abap deleted file mode 100644 index b5ca69c..0000000 --- a/tasks_gen/eval/G0141/hidden/news_dist_hidden.clas.abap +++ /dev/null @@ -1,108 +0,0 @@ -CLASS {{p}}news_dist_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - TYPES ty_date TYPE d. - TYPES tt_date TYPE RANGE OF ty_date. - TYPES ty_dist TYPE c LENGTH 4. - TYPES tt_dist TYPE RANGE OF ty_dist. - METHODS run - IMPORTING it_date TYPE tt_date OPTIONAL - it_dist TYPE tt_dist OPTIONAL - RETURNING VALUE(rr_data) TYPE REF TO data. - METHODS value_of - IMPORTING ir_data TYPE REF TO data - iv_row TYPE i - iv_col TYPE string - RETURNING VALUE(rv_value) TYPE string. - METHODS lines_of - IMPORTING ir_data TYPE REF TO data - RETURNING VALUE(rv_lines) TYPE i. - METHODS all_agents FOR TESTING. - METHODS sorted_by_rate FOR TESTING. - METHODS sums_and_rate FOR TESTING. - METHODS district_filter FOR TESTING. - METHODS date_filter FOR TESTING. - METHODS zero_copies FOR TESTING. - METHODS no_deliveries FOR TESTING. - METHODS outside_period FOR TESTING. -ENDCLASS. - -CLASS {{p}}news_dist_hidden IMPLEMENTATION. - METHOD run. - cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ). - SUBMIT {{p}}news_dist_old WITH s_date IN it_date WITH s_dist IN it_dist AND RETURN. - TRY. - cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ). - CATCH cx_salv_bs_sc_runtime_info. - ENDTRY. - cl_salv_bs_runtime_info=>clear_all( ). - ENDMETHOD. - - METHOD lines_of. - FIELD-SYMBOLS TYPE STANDARD TABLE. - IF ir_data IS BOUND. - ASSIGN ir_data->* TO . - rv_lines = lines( ). - ENDIF. - ENDMETHOD. - - METHOD value_of. - FIELD-SYMBOLS TYPE STANDARD TABLE. - ASSIGN ir_data->* TO . - ASSIGN [ iv_row ] TO FIELD-SYMBOL(). - ASSIGN COMPONENT iv_col OF STRUCTURE TO FIELD-SYMBOL(). - cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Column { iv_col } missing| ). - rv_value = condense( CONV string( ) ). - ENDMETHOD. - - METHOD all_agents. - cl_abap_unit_assert=>assert_equals( exp = 6 act = lines_of( run( ) ) ). - ENDMETHOD. - - METHOD sorted_by_rate. - DATA(lr_data) = run( ). - cl_abap_unit_assert=>assert_equals( exp = `A5` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `AGENT` ) ). - cl_abap_unit_assert=>assert_equals( exp = `A6` act = value_of( ir_data = lr_data iv_row = 6 iv_col = `AGENT` ) ). - ENDMETHOD. - - METHOD sums_and_rate. - DATA(lr_data) = run( it_date = VALUE #( ( sign = 'I' option = 'BT' low = '20260101' high = '20260131' ) ) ). - cl_abap_unit_assert=>assert_equals( exp = 6 act = lines_of( lr_data ) ). - cl_abap_unit_assert=>assert_equals( exp = `A1` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `AGENT` ) ). - cl_abap_unit_assert=>assert_equals( exp = `200` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `COPIES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `15` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `RETURNED` ) ). - cl_abap_unit_assert=>assert_equals( exp = `7.50` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `RATE` ) ). - ENDMETHOD. - - METHOD district_filter. - DATA(lr_data) = run( it_dist = VALUE #( ( sign = 'I' option = 'EQ' low = 'W' ) ) ). - cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ). - cl_abap_unit_assert=>assert_equals( exp = `A5` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `AGENT` ) ). - ENDMETHOD. - - METHOD date_filter. - DATA(lr_data) = run( it_date = VALUE #( ( sign = 'I' option = 'GE' low = '20260110' ) ) ). - cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ). - cl_abap_unit_assert=>assert_equals( exp = `A1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `AGENT` ) ). - cl_abap_unit_assert=>assert_equals( exp = `A3` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `AGENT` ) ). - ENDMETHOD. - - METHOD zero_copies. - DATA(lr_data) = run( it_dist = VALUE #( ( sign = 'I' option = 'EQ' low = 'W' ) ) ). - cl_abap_unit_assert=>assert_equals( exp = `A6` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `AGENT` ) ). - cl_abap_unit_assert=>assert_equals( exp = `0` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `COPIES` ) ). - cl_abap_unit_assert=>assert_equals( exp = `0.00` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `RATE` ) ). - ENDMETHOD. - - METHOD no_deliveries. - cl_abap_unit_assert=>assert_equals( - exp = 0 - act = lines_of( run( it_dist = VALUE #( ( sign = 'I' option = 'EQ' low = 'E' ) ) ) ) ). - ENDMETHOD. - - METHOD outside_period. - cl_abap_unit_assert=>assert_equals( - exp = 0 - act = lines_of( run( it_date = VALUE #( ( sign = 'I' option = 'BT' low = '20270101' high = '20271231' ) ) ) ) ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0141/hidden/t15_hidden.clas.abap b/tasks_gen/eval/G0141/hidden/t15_hidden.clas.abap new file mode 100644 index 0000000..2b8e71f --- /dev/null +++ b/tasks_gen/eval/G0141/hidden/t15_hidden.clas.abap @@ -0,0 +1,107 @@ +CLASS {{p}}t15_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + TYPES tt_team TYPE RANGE OF {{p}}ticket-team. + METHODS run + IMPORTING iv_from TYPE d + iv_to TYPE d + it_team TYPE tt_team OPTIONAL + RETURNING VALUE(rr_data) TYPE REF TO data. + METHODS lines_of + IMPORTING ir_data TYPE REF TO data + RETURNING VALUE(rv_lines) TYPE i. + METHODS value_of + IMPORTING ir_data TYPE REF TO data + iv_row TYPE i + iv_col TYPE string + RETURNING VALUE(rv_value) TYPE string. + METHODS counts_and_urgent FOR TESTING. + METHODS sorted_by_tickets FOR TESTING. + METHODS urgent_rule FOR TESTING. + METHODS date_filter_from FOR TESTING. + METHODS date_filter_to FOR TESTING. + METHODS team_filter FOR TESTING. +ENDCLASS. + + +CLASS {{p}}t15_hidden IMPLEMENTATION. + METHOD run. + cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ). + SUBMIT {{p}}helpdesk_old + WITH p_from = iv_from + WITH p_to = iv_to + WITH s_team IN it_team + AND RETURN. + TRY. + cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ). + CATCH cx_salv_bs_sc_runtime_info. + ENDTRY. + cl_salv_bs_runtime_info=>clear_all( ). + ENDMETHOD. + + METHOD lines_of. + FIELD-SYMBOLS TYPE STANDARD TABLE. + IF ir_data IS BOUND. + ASSIGN ir_data->* TO . + rv_lines = lines( ). + ENDIF. + ENDMETHOD. + + METHOD value_of. + FIELD-SYMBOLS TYPE STANDARD TABLE. + ASSIGN ir_data->* TO . + ASSIGN [ iv_row ] TO FIELD-SYMBOL(). + ASSIGN COMPONENT iv_col OF STRUCTURE TO FIELD-SYMBOL(). + cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Column { iv_col } missing| ). + rv_value = condense( CONV string( ) ). + ENDMETHOD. + + METHOD counts_and_urgent. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = 4 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( exp = `BETA` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TEAM` ) ). + cl_abap_unit_assert=>assert_equals( exp = `3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TICKETS` ) ). + cl_abap_unit_assert=>assert_equals( exp = `2` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `URGENT` ) ). + ENDMETHOD. + + METHOD sorted_by_tickets. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = `BETA` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TEAM` ) ). + cl_abap_unit_assert=>assert_equals( exp = `ALPHA` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `TEAM` ) ). + cl_abap_unit_assert=>assert_equals( exp = `DELTA` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `TEAM` ) ). + cl_abap_unit_assert=>assert_equals( exp = `GAMMA` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `TEAM` ) ). + ENDMETHOD. + + METHOD urgent_rule. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `TICKETS` ) ). + cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `URGENT` ) ). + cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `TICKETS` ) ). + cl_abap_unit_assert=>assert_equals( exp = `0` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `URGENT` ) ). + ENDMETHOD. + + METHOD date_filter_from. + DATA(lr_data) = run( iv_from = '20260201' iv_to = '20260331' ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( exp = `ALPHA` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TEAM` ) ). + cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TICKETS` ) ). + cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `URGENT` ) ). + ENDMETHOD. + + METHOD date_filter_to. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260109' ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( exp = `BETA` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TEAM` ) ). + cl_abap_unit_assert=>assert_equals( exp = `3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TICKETS` ) ). + cl_abap_unit_assert=>assert_equals( exp = `ALPHA` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `TEAM` ) ). + ENDMETHOD. + + METHOD team_filter. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260331' + it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'BETA' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( exp = `BETA` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TEAM` ) ). + cl_abap_unit_assert=>assert_equals( exp = `4` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TICKETS` ) ). + cl_abap_unit_assert=>assert_equals( exp = `3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `URGENT` ) ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0141/mutation.json b/tasks_gen/eval/G0141/mutation.json index 1dc020e..dbafaab 100644 --- a/tasks_gen/eval/G0141/mutation.json +++ b/tasks_gen/eval/G0141/mutation.json @@ -1,34 +1,74 @@ { - "task": "E21", + "task": "G0141", "mutants": [ { - "object": "{{P}}NEWS_DIST_OLD", - "mutant": "SORT: DESCENDING -> ASCENDING", + "object": "{{P}}HELPDESK_OLD", + "mutant": "line 42: AND -> OR (logic)", "status": "killed", - "hidden": "4/8", + "hidden": "0/6", "failed_tests": [ - "sorted_by_rate", - "sums_and_rate", - "district_filter", - "zero_copies" + "COUNTS_AND_URGENT", + "DATE_FILTER_FROM", + "DATE_FILTER_TO", + "SORTED_BY_TICKETS", + "TEAM_FILTER", + "URGENT_RULE" ] }, { - "object": "{{P}}NEWS_DIST_OLD", - "mutant": "rate guard: > -> >=", + "object": "{{P}}HELPDESK_OLD", + "mutant": "line 52: <> -> = (rel)", "status": "killed", - "hidden": "5/8", + "hidden": "0/6", "failed_tests": [ - "all_agents", - "sorted_by_rate", - "sums_and_rate", - "district_filter", - "zero_copies" + "COUNTS_AND_URGENT", + "DATE_FILTER_FROM", + "DATE_FILTER_TO", + "SORTED_BY_TICKETS", + "TEAM_FILTER", + "URGENT_RULE" + ] + }, + { + "object": "{{P}}HELPDESK_OLD", + "mutant": "line 56: abap_false -> abap_true (bool)", + "status": "killed", + "hidden": "0/6", + "failed_tests": [ + "COUNTS_AND_URGENT", + "DATE_FILTER_FROM", + "DATE_FILTER_TO", + "SORTED_BY_TICKETS", + "TEAM_FILTER", + "URGENT_RULE" + ] + }, + { + "object": "{{P}}HELPDESK_OLD", + "mutant": "line 59: = -> <> (eq)", + "status": "killed", + "hidden": "3/6", + "failed_tests": [ + "COUNTS_AND_URGENT", + "TEAM_FILTER", + "URGENT_RULE" + ] + }, + { + "object": "{{P}}HELPDESK_OLD", + "mutant": "line 60: + -> - (arith)", + "status": "killed", + "hidden": "2/6", + "failed_tests": [ + "COUNTS_AND_URGENT", + "DATE_FILTER_FROM", + "TEAM_FILTER", + "URGENT_RULE" ] } ], - "valid": 2, - "killed": 2, + "valid": 5, + "killed": 5, "kill_rate": 1.0, "ok": true } \ No newline at end of file diff --git a/tasks_gen/eval/G0141/reference/helpdesk_old.prog.abap b/tasks_gen/eval/G0141/reference/helpdesk_old.prog.abap new file mode 100644 index 0000000..db136c9 --- /dev/null +++ b/tasks_gen/eval/G0141/reference/helpdesk_old.prog.abap @@ -0,0 +1,160 @@ +REPORT {{p}}helpdesk_old. + +DATA gv_team TYPE {{p}}ticket-team. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_team FOR gv_team. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_line, + team TYPE {{p}}ticket-team, + tickets TYPE i, + urgent TYPE i, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_team TYPE RANGE OF {{p}}ticket-team. + TYPES: + BEGIN OF ty_group, + team TYPE {{p}}ticket-team, + priority TYPE {{p}}ticket-priority, + cnt TYPE i, + END OF ty_group, + tt_group TYPE STANDARD TABLE OF ty_group WITH EMPTY KEY. + + METHODS select_teams + IMPORTING iv_from TYPE d + iv_to TYPE d + it_team TYPE tt_team + RETURNING VALUE(rt_line) TYPE tt_line. + + METHODS display + CHANGING ct_line TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_teams. + SELECT team, priority, COUNT(*) AS cnt + FROM {{p}}ticket + WHERE opened_on >= @iv_from + AND opened_on <= @iv_to + AND team IN @it_team + GROUP BY team, priority + INTO TABLE @DATA(lt_group). + + SORT lt_group BY team. + + DATA ls_line TYPE ty_line. + DATA lv_first TYPE abap_bool VALUE abap_true. + LOOP AT lt_group INTO DATA(ls_group). + IF lv_first = abap_false AND ls_line-team <> ls_group-team. + APPEND ls_line TO rt_line. + CLEAR ls_line. + ENDIF. + lv_first = abap_false. + ls_line-team = ls_group-team. + ls_line-tickets = ls_line-tickets + ls_group-cnt. + IF ls_group-priority = '1' OR ls_group-priority = '2'. + ls_line-urgent = ls_line-urgent + ls_group-cnt. + ENDIF. + ENDLOOP. + IF lv_first = abap_false. + APPEND ls_line TO rt_line. + ENDIF. + + SORT rt_line BY tickets DESCENDING team ASCENDING. + ENDMETHOD. + + METHOD display. + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) + CHANGING t_table = ct_line ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA(go_report) = NEW lcl_report( ). + DATA(gt_line) = go_report->select_teams( iv_from = p_from iv_to = p_to it_team = s_team[] ). + go_report->display( CHANGING ct_line = gt_line ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + CLASS-DATA go_env TYPE REF TO if_osql_test_environment. + CLASS-METHODS class_setup. + CLASS-METHODS class_teardown. + METHODS setup. + METHODS counts_per_team FOR TESTING. + METHODS urgent_rule FOR TESTING. + METHODS date_filter FOR TESTING. + METHODS team_filter FOR TESTING. + METHODS sorted_by_tickets FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD class_setup. + go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}TICKET' ) ) ). + ENDMETHOD. + + METHOD class_teardown. + go_env->destroy( ). + ENDMETHOD. + + METHOD setup. + go_env->clear_doubles( ). + DATA lt_ticket TYPE STANDARD TABLE OF {{p}}ticket WITH EMPTY KEY. + lt_ticket = VALUE #( + ( ticket_id = 1 team = 'A' priority = '1' opened_on = '20260105' ) + ( ticket_id = 2 team = 'A' priority = '3' opened_on = '20260110' ) + ( ticket_id = 3 team = 'B' priority = '1' opened_on = '20260107' ) + ( ticket_id = 4 team = 'B' priority = '1' opened_on = '20260108' ) + ( ticket_id = 5 team = 'B' priority = '4' opened_on = '20260109' ) + ( ticket_id = 6 team = 'C' priority = '2' opened_on = '20260201' ) ). + go_env->insert_test_data( lt_ticket ). + ENDMETHOD. + + METHOD counts_per_team. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD urgent_rule. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260201' iv_to = '20260228' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-urgent ). + ENDMETHOD. + + METHOD date_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260109' iv_to = '20260109' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD team_filter. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' + it_team = VALUE #( ( sign = 'I' option = 'EQ' low = 'A' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_line ) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_line[ 1 ]-tickets ). + ENDMETHOD. + + METHOD sorted_by_tickets. + DATA(lt_line) = NEW lcl_report( )->select_teams( + iv_from = '20260101' iv_to = '20260131' it_team = VALUE #( ) ). + cl_abap_unit_assert=>assert_equals( exp = 'B' act = lt_line[ 1 ]-team ). + cl_abap_unit_assert=>assert_equals( exp = 'A' act = lt_line[ 2 ]-team ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0141/reference/news_dist_old.prog.abap b/tasks_gen/eval/G0141/reference/news_dist_old.prog.abap deleted file mode 100644 index 2970dac..0000000 --- a/tasks_gen/eval/G0141/reference/news_dist_old.prog.abap +++ /dev/null @@ -1,131 +0,0 @@ -REPORT {{p}}news_dist_old. - -TYPES ty_rate TYPE p LENGTH 8 DECIMALS 2. - -TYPES: BEGIN OF ty_line, - agent TYPE {{p}}agent-agent_id, - name TYPE {{p}}agent-agent_name, - district TYPE {{p}}agent-district, - copies TYPE i, - returned TYPE i, - rate TYPE ty_rate, - END OF ty_line. -TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY. -TYPES ty_date TYPE d. -TYPES tt_date TYPE RANGE OF ty_date. -TYPES ty_dist TYPE c LENGTH 4. -TYPES tt_dist TYPE RANGE OF ty_dist. - -DATA gv_date TYPE ty_date. -DATA gv_dist TYPE ty_dist. - -SELECT-OPTIONS s_date FOR gv_date. -SELECT-OPTIONS s_dist FOR gv_dist. - -CLASS lcl_report DEFINITION FINAL. - PUBLIC SECTION. - METHODS select_lines - IMPORTING it_date TYPE tt_date - it_dist TYPE tt_dist - RETURNING VALUE(rt_lines) TYPE tt_line. - METHODS display - CHANGING ct_lines TYPE tt_line. - PRIVATE SECTION. - METHODS add_rate - CHANGING cs_line TYPE ty_line. -ENDCLASS. - -CLASS lcl_report IMPLEMENTATION. - METHOD select_lines. - SELECT a~agent_id AS agent, - a~agent_name AS name, - a~district AS district, - SUM( d~del_copies ) AS copies, - SUM( d~ret_copies ) AS returned - FROM {{p}}agent AS a - INNER JOIN {{p}}deliv AS d ON d~agent_id = a~agent_id - WHERE d~del_date IN @it_date - AND a~district IN @it_dist - GROUP BY a~agent_id, a~agent_name, a~district - INTO CORRESPONDING FIELDS OF TABLE @rt_lines. - - LOOP AT rt_lines ASSIGNING FIELD-SYMBOL(). - add_rate( CHANGING cs_line = ). - ENDLOOP. - - SORT rt_lines BY rate DESCENDING agent ASCENDING. - ENDMETHOD. - - METHOD add_rate. - DATA lv_copies TYPE p LENGTH 15 DECIMALS 2. - lv_copies = cs_line-copies. - IF lv_copies > 0. - cs_line-rate = cs_line-returned * 100 / lv_copies. - ELSE. - cs_line-rate = 0. - ENDIF. - ENDMETHOD. - - METHOD display. - TRY. - cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) - CHANGING t_table = ct_lines ). - lo_alv->display( ). - CATCH cx_salv_msg INTO DATA(lx_error). - MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. - ENDTRY. - ENDMETHOD. -ENDCLASS. - -START-OF-SELECTION. - DATA(go_report) = NEW lcl_report( ). - DATA(gt_lines) = go_report->select_lines( it_date = s_date[] - it_dist = s_dist[] ). - go_report->display( CHANGING ct_lines = gt_lines ). - -CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - CLASS-DATA go_env TYPE REF TO if_osql_test_environment. - CLASS-METHODS class_setup. - CLASS-METHODS class_teardown. - METHODS sums_per_agent FOR TESTING. - METHODS rate_with_zero_copies FOR TESTING. -ENDCLASS. - -CLASS ltc_report IMPLEMENTATION. - METHOD class_setup. - go_env = cl_osql_test_environment=>create( - i_dependency_list = VALUE #( ( '{{P}}AGENT' ) ( '{{P}}DELIV' ) ) ). - DATA lt_agent TYPE STANDARD TABLE OF {{p}}agent WITH EMPTY KEY. - lt_agent = VALUE #( ( agent_id = 'A1' agent_name = 'One' district = 'N' ) - ( agent_id = 'A2' agent_name = 'Two' district = 'S' ) ). - go_env->insert_test_data( lt_agent ). - DATA lt_deliv TYPE STANDARD TABLE OF {{p}}deliv WITH EMPTY KEY. - lt_deliv = VALUE #( ( deliv_id = 1 agent_id = 'A1' del_date = '20260105' del_copies = 100 ret_copies = 5 ) - ( deliv_id = 2 agent_id = 'A1' del_date = '20260112' del_copies = 100 ret_copies = 15 ) - ( deliv_id = 3 agent_id = 'A2' del_date = '20260106' del_copies = 0 ret_copies = 0 ) ). - go_env->insert_test_data( lt_deliv ). - ENDMETHOD. - - METHOD class_teardown. - go_env->destroy( ). - ENDMETHOD. - - METHOD sums_per_agent. - DATA(lt_lines) = NEW lcl_report( )->select_lines( it_date = VALUE tt_date( ) - it_dist = VALUE tt_dist( ) ). - cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). - cl_abap_unit_assert=>assert_equals( exp = 'A1' act = lt_lines[ 1 ]-agent ). - cl_abap_unit_assert=>assert_equals( exp = 200 act = lt_lines[ 1 ]-copies ). - cl_abap_unit_assert=>assert_equals( exp = 20 act = lt_lines[ 1 ]-returned ). - cl_abap_unit_assert=>assert_equals( exp = '10.00' act = |{ lt_lines[ 1 ]-rate }| ). - ENDMETHOD. - - METHOD rate_with_zero_copies. - DATA(lt_lines) = NEW lcl_report( )->select_lines( it_date = VALUE tt_date( ) - it_dist = VALUE tt_dist( ) ). - cl_abap_unit_assert=>assert_equals( exp = 'A2' act = lt_lines[ 2 ]-agent ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lt_lines[ 2 ]-copies ). - cl_abap_unit_assert=>assert_equals( exp = '0.00' act = |{ lt_lines[ 2 ]-rate }| ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0141/seed/agent.tabl.asabap b/tasks_gen/eval/G0141/seed/agent.tabl.asabap deleted file mode 100644 index 2f0540a..0000000 --- a/tasks_gen/eval/G0141/seed/agent.tabl.asabap +++ /dev/null @@ -1,11 +0,0 @@ -@EndUserText.label : 'Newsagent' -@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE -@AbapCatalog.tableCategory : #TRANSPARENT -@AbapCatalog.deliveryClass : #A -@AbapCatalog.dataMaintenance : #RESTRICTED -define table {{p}}agent { - key client : abap.clnt not null; - key agent_id : abap.char(6) not null; - agent_name : abap.char(40); - district : abap.char(4); -} diff --git a/tasks_gen/eval/G0141/seed/deliv.tabl.asabap b/tasks_gen/eval/G0141/seed/deliv.tabl.asabap deleted file mode 100644 index da0fce9..0000000 --- a/tasks_gen/eval/G0141/seed/deliv.tabl.asabap +++ /dev/null @@ -1,13 +0,0 @@ -@EndUserText.label : 'News delivery' -@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE -@AbapCatalog.tableCategory : #TRANSPARENT -@AbapCatalog.deliveryClass : #A -@AbapCatalog.dataMaintenance : #RESTRICTED -define table {{p}}deliv { - key client : abap.clnt not null; - key deliv_id : abap.int4 not null; - agent_id : abap.char(6); - del_date : abap.dats; - del_copies : abap.int4; - ret_copies : abap.int4; -} diff --git a/tasks_gen/eval/G0141/seed/hd_seed.clas.abap b/tasks_gen/eval/G0141/seed/hd_seed.clas.abap new file mode 100644 index 0000000..e3bf650 --- /dev/null +++ b/tasks_gen/eval/G0141/seed/hd_seed.clas.abap @@ -0,0 +1,23 @@ +CLASS {{p}}hd_seed DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES if_oo_adt_classrun. +ENDCLASS. + +CLASS {{p}}hd_seed IMPLEMENTATION. + METHOD if_oo_adt_classrun~main. + DELETE FROM {{p}}ticket. + INSERT {{p}}ticket FROM TABLE @( VALUE #( + ( ticket_id = 1 team = 'ALPHA' priority = '1' opened_on = '20260105' ) + ( ticket_id = 2 team = 'ALPHA' priority = '3' opened_on = '20260110' ) + ( ticket_id = 3 team = 'ALPHA' priority = '2' opened_on = '20260201' ) + ( ticket_id = 4 team = 'BETA' priority = '1' opened_on = '20260107' ) + ( ticket_id = 5 team = 'BETA' priority = '1' opened_on = '20260108' ) + ( ticket_id = 6 team = 'BETA' priority = '4' opened_on = '20260109' ) + ( ticket_id = 7 team = 'BETA' priority = '2' opened_on = '20260301' ) + ( ticket_id = 8 team = 'GAMMA' priority = '3' opened_on = '20260115' ) + ( ticket_id = 9 team = 'GAMMA' priority = '1' opened_on = '20251220' ) + ( ticket_id = 10 team = 'DELTA' priority = '2' opened_on = '20260120' ) + ( ticket_id = 11 team = 'EPSILON' priority = '1' opened_on = '20251101' ) ) ). + out->write( sy-dbcnt ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0141/seed/helpdesk_old.prog.abap b/tasks_gen/eval/G0141/seed/helpdesk_old.prog.abap new file mode 100644 index 0000000..f0a30d1 --- /dev/null +++ b/tasks_gen/eval/G0141/seed/helpdesk_old.prog.abap @@ -0,0 +1,51 @@ +REPORT {{p}}helpdesk_old. + +TYPES: BEGIN OF ty_line, + team TYPE {{p}}ticket-team, + tickets TYPE i, + urgent TYPE i, + END OF ty_line. + +DATA: gt_line TYPE STANDARD TABLE OF ty_line, + gt_team TYPE STANDARD TABLE OF {{p}}ticket-team, + gv_tickets TYPE i, + gv_urgent TYPE i, + ls_line TYPE ty_line, + lv_team TYPE {{p}}ticket-team, + gv_team TYPE {{p}}ticket-team, + lo_alv TYPE REF TO cl_salv_table. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_team FOR gv_team. + +START-OF-SELECTION. + SELECT DISTINCT team FROM {{p}}ticket INTO TABLE gt_team + WHERE opened_on >= p_from AND opened_on <= p_to + AND team IN s_team. + + LOOP AT gt_team INTO lv_team. + SELECT COUNT(*) FROM {{p}}ticket INTO gv_tickets + WHERE team = lv_team + AND opened_on >= p_from AND opened_on <= p_to. + + SELECT COUNT(*) FROM {{p}}ticket INTO gv_urgent + WHERE team = lv_team + AND opened_on >= p_from AND opened_on <= p_to + AND ( priority = '1' OR priority = '2' ). + + ls_line-team = lv_team. + ls_line-tickets = gv_tickets. + ls_line-urgent = gv_urgent. + APPEND ls_line TO gt_line. + ENDLOOP. + + SORT gt_line BY tickets DESCENDING team ASCENDING. + + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv + CHANGING t_table = gt_line ). + lo_alv->display( ). + CATCH cx_salv_msg INTO DATA(lx_error). + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. diff --git a/tasks_gen/eval/G0141/seed/news_dist_old.prog.abap b/tasks_gen/eval/G0141/seed/news_dist_old.prog.abap deleted file mode 100644 index c1a83cf..0000000 --- a/tasks_gen/eval/G0141/seed/news_dist_old.prog.abap +++ /dev/null @@ -1,72 +0,0 @@ -REPORT {{p}}news_dist_old. - -* Legacy distribution report of the newspaper publisher. -* Shows the delivered copies and the returns of each newsagent. - -TYPES ty_rate TYPE p LENGTH 8 DECIMALS 2. - -TYPES: BEGIN OF ty_out, - agent TYPE {{p}}agent-agent_id, - name TYPE {{p}}agent-agent_name, - district TYPE {{p}}agent-district, - copies TYPE i, - returned TYPE i, - rate TYPE ty_rate, - END OF ty_out. - -DATA: gt_agent TYPE STANDARD TABLE OF {{p}}agent, - gs_agent TYPE {{p}}agent, - gt_deliv TYPE STANDARD TABLE OF {{p}}deliv, - gs_deliv TYPE {{p}}deliv, - gs_out TYPE ty_out, - gt_out TYPE STANDARD TABLE OF ty_out, - gt_list TYPE STANDARD TABLE OF ty_out, - gv_date TYPE d, - gv_dist TYPE c LENGTH 4, - go_alv TYPE REF TO cl_salv_table. - -SELECT-OPTIONS s_date FOR gv_date. -SELECT-OPTIONS s_dist FOR gv_dist. - -START-OF-SELECTION. - SELECT * FROM {{p}}agent INTO TABLE gt_agent. - LOOP AT gt_agent INTO gs_agent. - SELECT * FROM {{p}}deliv INTO TABLE gt_deliv - WHERE agent_id = gs_agent-agent_id - AND del_date IN s_date. - IF gt_deliv IS NOT INITIAL. - CLEAR gs_out. - gs_out-agent = gs_agent-agent_id. - gs_out-name = gs_agent-agent_name. - gs_out-district = gs_agent-district. - LOOP AT gt_deliv INTO gs_deliv. - gs_out-copies = gs_out-copies + gs_deliv-del_copies. - gs_out-returned = gs_out-returned + gs_deliv-ret_copies. - ENDLOOP. - PERFORM calc_rate USING gs_out-returned gs_out-copies - CHANGING gs_out-rate. - APPEND gs_out TO gt_out. - ENDIF. - ENDLOOP. - LOOP AT gt_out INTO gs_out WHERE district IN s_dist. - APPEND gs_out TO gt_list. - ENDLOOP. - SORT gt_list BY rate DESCENDING agent ASCENDING. - TRY. - cl_salv_table=>factory( IMPORTING r_salv_table = go_alv - CHANGING t_table = gt_list ). - go_alv->display( ). - CATCH cx_salv_msg. - ENDTRY. - -FORM calc_rate USING iv_returned TYPE i - iv_copies TYPE i - CHANGING cv_rate TYPE ty_rate. - DATA lv_copies TYPE p LENGTH 15 DECIMALS 2. - lv_copies = iv_copies. - IF lv_copies > 0. - cv_rate = iv_returned * 100 / lv_copies. - ELSE. - CLEAR cv_rate. - ENDIF. -ENDFORM. diff --git a/tasks_gen/eval/G0141/seed/news_seed.clas.abap b/tasks_gen/eval/G0141/seed/news_seed.clas.abap deleted file mode 100644 index 5ddad18..0000000 --- a/tasks_gen/eval/G0141/seed/news_seed.clas.abap +++ /dev/null @@ -1,33 +0,0 @@ -CLASS {{p}}news_seed DEFINITION PUBLIC FINAL CREATE PUBLIC. - PUBLIC SECTION. - INTERFACES if_oo_adt_classrun. -ENDCLASS. - -CLASS {{p}}news_seed IMPLEMENTATION. - METHOD if_oo_adt_classrun~main. - DELETE FROM {{p}}deliv. - DELETE FROM {{p}}agent. - - INSERT {{p}}agent FROM TABLE @( VALUE #( - ( agent_id = 'A1' agent_name = 'Corner Shop' district = 'N' ) - ( agent_id = 'A2' agent_name = 'Station Kiosk' district = 'N' ) - ( agent_id = 'A3' agent_name = 'City News' district = 'S' ) - ( agent_id = 'A4' agent_name = 'Harbour Store' district = 'S' ) - ( agent_id = 'A5' agent_name = 'Airport Shop' district = 'W' ) - ( agent_id = 'A6' agent_name = 'Closed Kiosk' district = 'W' ) - ( agent_id = 'A7' agent_name = 'Village Store' district = 'E' ) ) ). - - INSERT {{p}}deliv FROM TABLE @( VALUE #( - ( deliv_id = 1 agent_id = 'A1' del_date = '20260105' del_copies = 100 ret_copies = 5 ) - ( deliv_id = 2 agent_id = 'A1' del_date = '20260112' del_copies = 100 ret_copies = 10 ) - ( deliv_id = 3 agent_id = 'A2' del_date = '20251220' del_copies = 40 ret_copies = 4 ) - ( deliv_id = 4 agent_id = 'A2' del_date = '20260106' del_copies = 50 ret_copies = 0 ) - ( deliv_id = 5 agent_id = 'A3' del_date = '20260107' del_copies = 200 ret_copies = 40 ) - ( deliv_id = 6 agent_id = 'A3' del_date = '20260114' del_copies = 200 ret_copies = 20 ) - ( deliv_id = 7 agent_id = 'A4' del_date = '20260108' del_copies = 80 ret_copies = 8 ) - ( deliv_id = 8 agent_id = 'A5' del_date = '20260109' del_copies = 60 ret_copies = 30 ) - ( deliv_id = 9 agent_id = 'A6' del_date = '20260103' del_copies = 0 ret_copies = 0 ) ) ). - - out->write( 'Seed done' ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0141/seed/ticket.tabl.asabap b/tasks_gen/eval/G0141/seed/ticket.tabl.asabap new file mode 100644 index 0000000..151c58f --- /dev/null +++ b/tasks_gen/eval/G0141/seed/ticket.tabl.asabap @@ -0,0 +1,12 @@ +@EndUserText.label : 'Support tickets' +@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE +@AbapCatalog.tableCategory : #TRANSPARENT +@AbapCatalog.deliveryClass : #A +@AbapCatalog.dataMaintenance : #RESTRICTED +define table {{p}}ticket { + key client : abap.clnt not null; + key ticket_id : abap.int4 not null; + team : abap.char(12); + priority : abap.char(1); + opened_on : abap.dats; +} diff --git a/tasks_gen/eval/G0141/spec.md b/tasks_gen/eval/G0141/spec.md index 0c45c39..dbe98c4 100644 --- a/tasks_gen/eval/G0141/spec.md +++ b/tasks_gen/eval/G0141/spec.md @@ -1,52 +1,51 @@ # 1. Goal -The program {{P}}NEWS_DIST_OLD in package $TMP is the legacy distribution -report of a regional newspaper publisher. It shows, for a period, the copies -that each newsagent received and returned. The report works, but its source -does not meet the current quality standards of the company. Refactor the -source of {{P}}NEWS_DIST_OLD in place. The behavior of the program stays the +The report {{P}}HELPDESK_OLD in package $TMP shows the support tickets of a +service desk. The report works, but its source code is old and hard to +maintain. Refactor the report in place. The behaviour of the report stays the same. # 2. Open questions None. # 3. Context -- The executable program {{P}}NEWS_DIST_OLD exists in package $TMP and is - active. Its source is the legacy code that you refactor. -- The tables {{P}}AGENT and {{P}}DELIV exist in package $TMP and contain data. -- Users run the program with the selection screen and read the ALV list. +- The executable program {{P}}HELPDESK_OLD already exists in package $TMP and + is active. Its source code is the specification of the behaviour. Read the + source code before you change it. +- The report reads the table {{P}}TICKET. The table contains data. + Fields: + - TICKET_ID (INT4, key): the number of the ticket. + - TEAM (CHAR 12): the support team that owns the ticket. + - PRIORITY (CHAR 1): the priority of the ticket. + - OPENED_ON (DATS): the day on which the ticket was opened. # 4. Contract -- Object: the executable program {{P}}NEWS_DIST_OLD in package $TMP. - Refactor this program in place. Keep the name. Do not create a new program. +- Refactor the executable program {{P}}HELPDESK_OLD in package $TMP. The name + of the program and its public interface do not change. - Selection screen, unchanged: - - Select-option S_DATE for the delivery date. - - Select-option S_DIST for the district. -- The program shows the result with CL_SALV_TABLE, as before. -- The ALV list keeps these column names: - AGENT, NAME, DISTRICT, COPIES, RETURNED, RATE. + - Parameter P_FROM, type DATS, mandatory. + - Parameter P_TO, type DATS, mandatory. + - Select-option S_TEAM for the team. +- The report shows the result with CL_SALV_TABLE. The output table has these + columns with these names: TEAM, TICKETS, URGENT. # 5. Business rules -The behavior of the program does not change. The legacy source of -{{P}}NEWS_DIST_OLD is the specification of the behavior. Read the source and -keep all of it: -- the filters of the selection screen, -- the set of lines of the list, -- the values of the columns, -- the sort order of the lines. -Do not change the result of the program. +The behaviour of the report stays the same. The current source code of +{{P}}HELPDESK_OLD defines the behaviour: which tickets are included, the +values of the output columns, and the order of the output lines. Read the +source code and keep all of it. # 6. Constraints -- Release target: 8.16. +- Release target: SAP_BASIS 816 (ABAP Platform 2025). - Coding standards: Clean ABAP. -- The refactored program has no database access inside a loop. -- No method of the program has more than 40 statements. -- The program has no ATC finding of priority 1 or 2. -- Write ABAP Unit tests as local test classes in the program. -- Out of scope: do not change the tables {{P}}AGENT and {{P}}DELIV. - Do not change the selection screen names and the ALV column names. + - Read the ticket data with one database access. Do not read the database + in a loop. + - Keep the methods below 40 statements. + - Pass large parameters by reference. + - The refactored program has no ATC finding of priority 1 or priority 2. +- Out of scope: do not change the table {{P}}TICKET. # 7. Acceptance -- {{P}}NEWS_DIST_OLD is active and has no syntax error. -- The result of the program is the same as before the refactoring. +- The program {{P}}HELPDESK_OLD is active and has no syntax error. +- The behaviour of the program is unchanged. - The hidden tests pass. -- The local test classes pass. +- Write ABAP Unit tests as local test classes in the program. diff --git a/tasks_gen/eval/G0141/task.json b/tasks_gen/eval/G0141/task.json index 906abdc..ecea3d5 100644 --- a/tasks_gen/eval/G0141/task.json +++ b/tasks_gen/eval/G0141/task.json @@ -12,58 +12,52 @@ "seed": [ { "type": "TABL", - "name": "{{P}}AGENT", - "file": "seed/agent.tabl.asabap", - "description": "Newsagents" - }, - { - "type": "TABL", - "name": "{{P}}DELIV", - "file": "seed/deliv.tabl.asabap", - "description": "News deliveries" + "name": "{{P}}TICKET", + "file": "seed/ticket.tabl.asabap", + "description": "Support tickets" }, { "type": "CLAS", - "name": "{{P}}NEWS_SEED", - "file": "seed/news_seed.clas.abap", - "description": "Seed data", + "name": "{{P}}HD_SEED", + "file": "seed/hd_seed.clas.abap", + "description": "T15 seed data", "run": true }, { "type": "PROG", - "name": "{{P}}NEWS_DIST_OLD", - "file": "seed/news_dist_old.prog.abap", - "description": "Legacy distribution report" + "name": "{{P}}HELPDESK_OLD", + "file": "seed/helpdesk_old.prog.abap", + "description": "Legacy helpdesk report" } ], "contract": [ { "type": "PROG", - "name": "{{P}}NEWS_DIST_OLD", + "name": "{{P}}HELPDESK_OLD", "parameters": [ - "s_date", - "s_dist" + "p_from", + "p_to", + "s_team" ] } ], "out_of_scope": [ - "{{P}}AGENT", - "{{P}}DELIV" + "{{P}}TICKET" ], "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}NEWS_DIST_HIDDEN", - "file": "hidden/news_dist_hidden.clas.abap", - "description": "Hidden tests for the distribution report" + "name": "{{P}}T15_HIDDEN", + "file": "hidden/t15_hidden.clas.abap", + "description": "T15 hidden tests" } ], "reference": [ { "type": "PROG", - "name": "{{P}}NEWS_DIST_OLD", - "file": "reference/news_dist_old.prog.abap", - "description": "Refactored distribution report" + "name": "{{P}}HELPDESK_OLD", + "file": "reference/helpdesk_old.prog.abap", + "description": "Refactored helpdesk report" } ], "craft_checks": [ diff --git a/tasks_gen/eval/G0142/empirical.json b/tasks_gen/eval/G0142/empirical.json new file mode 100644 index 0000000..b89e189 --- /dev/null +++ b/tasks_gen/eval/G0142/empirical.json @@ -0,0 +1,17 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "failed_gates": [ + "G1_active", + "G2_contract", + "G3_hidden_runs" + ] + }, + "hidden": "0/0", + "tool_calls": 7, + "seconds": 756.1, + "run_dir": "runs/emp/11014_G0142_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0142/review.json b/tasks_gen/eval/G0142/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0142/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0143/generation.json b/tasks_gen/eval/G0143/generation.json new file mode 100644 index 0000000..58a3d3e --- /dev/null +++ b/tasks_gen/eval/G0143/generation.json @@ -0,0 +1,45 @@ +{ + "id": "G0143", + "pool": "eval", + "object_type": "FUNC", + "category": "E", + "attempts": [ + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "bundle", + "errors": [ + "category E: the contract object must be the seed object that the model changes in place (same name in seed, contract and reference)" + ], + "by_check": { + "static": 1 + } + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "revalidate", + "by": "harness fix 2026-10-03", + "change": "ADT activation fallback for a second FUNC write. Bundle not changed.", + "oracle": 0, + "null": 0, + "mutation": { + "valid": 0, + "killed": 0, + "ok": false + } + } + ], + "accepted": false +} \ No newline at end of file diff --git a/tasks_gen/eval/G0143/hidden/crane_hidden.clas.abap b/tasks_gen/eval/G0143/hidden/crane_hidden.clas.abap new file mode 100644 index 0000000..086a028 --- /dev/null +++ b/tasks_gen/eval/G0143/hidden/crane_hidden.clas.abap @@ -0,0 +1,97 @@ +CLASS {{p}}crane_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS call + IMPORTING iv_type TYPE string + iv_hours TYPE decfloat34 + iv_km TYPE i + iv_weekend TYPE abap_bool + iv_customer TYPE string + EXPORTING ev_base TYPE decfloat34 + ev_travel TYPE decfloat34 + ev_surcharge TYPE decfloat34 + ev_discount TYPE decfloat34 + ev_total TYPE decfloat34 + ev_subrc TYPE sysubrc. + METHODS small_crane_base FOR TESTING. + METHODS invalid_crane_type FOR TESTING. + METHODS invalid_hours FOR TESTING. + METHODS travel_fee_cap FOR TESTING. + METHODS weekend_surcharge FOR TESTING. + METHODS gold_discount FOR TESTING. + METHODS rounding_order FOR TESTING. + METHODS total_calculation FOR TESTING. +ENDCLASS. + + +CLASS {{p}}crane_hidden IMPLEMENTATION. + METHOD call. + CALL FUNCTION '{{P}}CRANE_FEE_OLD' + EXPORTING + iv_crane_type = iv_type + iv_hours = iv_hours + iv_distance_km = iv_km + iv_weekend = iv_weekend + iv_customer = iv_customer + IMPORTING + ev_base_fee = ev_base + ev_travel_fee = ev_travel + ev_surcharge = ev_surcharge + ev_discount = ev_discount + ev_total = ev_total + EXCEPTIONS + invalid_crane_type = 1 + invalid_hours = 2 + OTHERS = 3. + ev_subrc = sy-subrc. + ENDMETHOD. + + METHOD small_crane_base. + call( EXPORTING iv_type = 'SM' iv_hours = 2 iv_km = 0 iv_weekend = abap_false iv_customer = 'STD' + IMPORTING ev_base = DATA(lv_base) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 230 ) act = lv_base ). + ENDMETHOD. + + METHOD invalid_crane_type. + call( EXPORTING iv_type = 'XX' iv_hours = 1 iv_km = 0 iv_weekend = abap_false iv_customer = 'STD' + IMPORTING ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). + ENDMETHOD. + + METHOD invalid_hours. + call( EXPORTING iv_type = 'SM' iv_hours = 0 iv_km = 0 iv_weekend = abap_false iv_customer = 'STD' + IMPORTING ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc ). + ENDMETHOD. + + METHOD travel_fee_cap. + call( EXPORTING iv_type = 'SM' iv_hours = 1 iv_km = 200 iv_weekend = abap_false iv_customer = 'STD' + IMPORTING ev_travel = DATA(lv_travel) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 125 ) act = lv_travel ). + ENDMETHOD. + + METHOD weekend_surcharge. + call( EXPORTING iv_type = 'MD' iv_hours = 2 iv_km = 0 iv_weekend = abap_true iv_customer = 'STD' + IMPORTING ev_surcharge = DATA(lv_surcharge) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '92.50' ) act = lv_surcharge ). + ENDMETHOD. + + METHOD gold_discount. + call( EXPORTING iv_type = 'LG' iv_hours = 1 iv_km = 10 iv_weekend = abap_false iv_customer = 'GOLD' + IMPORTING ev_discount = DATA(lv_discount) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '36.85' ) act = lv_discount ). + ENDMETHOD. + + METHOD rounding_order. + call( EXPORTING iv_type = 'SM' iv_hours = CONV decfloat34( '0.87' ) iv_km = 0 iv_weekend = abap_false iv_customer = 'GOLD' + IMPORTING ev_discount = DATA(lv_discount) ev_total = DATA(lv_total) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.01' ) act = lv_discount ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '90.05' ) act = lv_total ). + ENDMETHOD. + + METHOD total_calculation. + call( EXPORTING iv_type = 'MD' iv_hours = 3 iv_km = 20 iv_weekend = abap_true iv_customer = 'GOLD' + IMPORTING ev_total = DATA(lv_total) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '655.88' ) act = lv_total ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0143/hidden/t14_hidden.clas.abap b/tasks_gen/eval/G0143/hidden/t14_hidden.clas.abap deleted file mode 100644 index 01399b4..0000000 --- a/tasks_gen/eval/G0143/hidden/t14_hidden.clas.abap +++ /dev/null @@ -1,106 +0,0 @@ -CLASS {{p}}t14_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - METHODS call - IMPORTING - iv_players TYPE i - iv_games TYPE i - iv_day TYPE i - iv_shoes TYPE abap_bool DEFAULT abap_false - EXPORTING - ev_fee TYPE decfloat34 - ev_note TYPE string - ev_subrc TYPE sysubrc. - METHODS weekday_rate FOR TESTING. - METHODS weekend_rate FOR TESTING. - METHODS lane_count FOR TESTING. - METHODS shoe_charge FOR TESTING. - METHODS group_discount FOR TESTING. - METHODS group_discount_negative FOR TESTING. - METHODS day_above_five FOR TESTING. - METHODS invalid_players FOR TESTING. - METHODS invalid_games FOR TESTING. - METHODS no_discount_below_twelve FOR TESTING. -ENDCLASS. - -CLASS {{p}}t14_hidden IMPLEMENTATION. - METHOD call. - CALL FUNCTION '{{P}}BOWL_FEE_OLD' - EXPORTING - iv_players = iv_players - iv_games = iv_games - iv_day = iv_day - iv_shoes = iv_shoes - IMPORTING - ev_fee = ev_fee - ev_note = ev_note - EXCEPTIONS - invalid_input = 1 - OTHERS = 2. - ev_subrc = sy-subrc. - ENDMETHOD. - - METHOD weekday_rate. - call( EXPORTING iv_players = 1 iv_games = 1 iv_day = 1 - IMPORTING ev_fee = DATA(lv_fee) ev_note = DATA(lv_note) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '3.50' ) act = lv_fee ). - cl_abap_unit_assert=>assert_equals( exp = 'BOOKED' act = lv_note ). - ENDMETHOD. - - METHOD weekend_rate. - call( EXPORTING iv_players = 6 iv_games = 2 iv_day = 6 - IMPORTING ev_fee = DATA(lv_fee) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.00' ) act = lv_fee ). - ENDMETHOD. - - METHOD lane_count. - call( EXPORTING iv_players = 7 iv_games = 1 iv_day = 1 - IMPORTING ev_fee = DATA(lv_fee) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '7.00' ) act = lv_fee ). - ENDMETHOD. - - METHOD shoe_charge. - call( EXPORTING iv_players = 7 iv_games = 1 iv_day = 1 iv_shoes = abap_true - IMPORTING ev_fee = DATA(lv_fee) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '21.00' ) act = lv_fee ). - ENDMETHOD. - - METHOD group_discount. - call( EXPORTING iv_players = 12 iv_games = 1 iv_day = 1 iv_shoes = abap_true - IMPORTING ev_fee = DATA(lv_fee) ev_note = DATA(lv_note) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '21.00' ) act = lv_fee ). - cl_abap_unit_assert=>assert_equals( exp = 'GROUP' act = lv_note ). - ENDMETHOD. - - METHOD group_discount_negative. - call( EXPORTING iv_players = 12 iv_games = 1 iv_day = 1 - IMPORTING ev_fee = DATA(lv_fee) ev_note = DATA(lv_note) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '-3.00' ) act = lv_fee ). - cl_abap_unit_assert=>assert_equals( exp = 'GROUP' act = lv_note ). - ENDMETHOD. - - METHOD day_above_five. - call( EXPORTING iv_players = 1 iv_games = 1 iv_day = 8 - IMPORTING ev_fee = DATA(lv_fee) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '5.00' ) act = lv_fee ). - ENDMETHOD. - - METHOD invalid_players. - call( EXPORTING iv_players = 0 iv_games = 1 iv_day = 1 - IMPORTING ev_subrc = DATA(lv_rc) ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). - ENDMETHOD. - - METHOD invalid_games. - call( EXPORTING iv_players = 1 iv_games = 0 iv_day = 1 - IMPORTING ev_subrc = DATA(lv_rc) ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). - ENDMETHOD. - - METHOD no_discount_below_twelve. - call( EXPORTING iv_players = 11 iv_games = 1 iv_day = 1 - IMPORTING ev_fee = DATA(lv_fee) ev_note = DATA(lv_note) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '7.00' ) act = lv_fee ). - cl_abap_unit_assert=>assert_equals( exp = 'BOOKED' act = lv_note ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0143/mutation.json b/tasks_gen/eval/G0143/mutation.json new file mode 100644 index 0000000..1476779 --- /dev/null +++ b/tasks_gen/eval/G0143/mutation.json @@ -0,0 +1,59 @@ +{ + "task": "T_CRANE", + "mutants": [ + { + "object": "{{P}}CRANE_FEE_OLD", + "mutant": "weekend surcharge 25 -> 20", + "status": "killed", + "hidden": "6/8", + "failed_tests": [ + "WEEKEND_SURCHARGE", + "TOTAL_CALCULATION" + ] + }, + { + "object": "{{P}}CRANE_FEE_OLD", + "mutant": "gold discount 10 -> 5", + "status": "killed", + "hidden": "5/8", + "failed_tests": [ + "GOLD_DISCOUNT", + "ROUNDING_ORDER", + "TOTAL_CALCULATION" + ] + }, + { + "object": "{{P}}CRANE_FEE_OLD", + "mutant": "travel cap 100 -> 50", + "status": "killed", + "hidden": "7/8", + "failed_tests": [ + "TRAVEL_FEE_CAP" + ] + }, + { + "object": "{{P}}CRANE_FEE_OLD", + "mutant": "round half up -> half down", + "status": "killed", + "hidden": "6/8", + "failed_tests": [ + "ROUNDING_ORDER", + "TOTAL_CALCULATION" + ] + }, + { + "object": "{{P}}CRANE_FEE_OLD", + "mutant": "SM hourly 115 -> 110", + "status": "killed", + "hidden": "6/8", + "failed_tests": [ + "SMALL_CRANE_BASE", + "ROUNDING_ORDER" + ] + } + ], + "valid": 5, + "killed": 5, + "kill_rate": 1.0, + "ok": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0143/reference/bowl_fee_old.func.abap b/tasks_gen/eval/G0143/reference/bowl_fee_old.func.abap deleted file mode 100644 index 26380ba..0000000 --- a/tasks_gen/eval/G0143/reference/bowl_fee_old.func.abap +++ /dev/null @@ -1,90 +0,0 @@ -FUNCTION {{p}}bowl_fee_old - IMPORTING - iv_players TYPE i - iv_games TYPE i - iv_day TYPE i - iv_shoes TYPE abap_bool - EXPORTING - ev_fee TYPE decfloat34 - ev_note TYPE string - EXCEPTIONS - invalid_input. - - TYPES ty_rate TYPE p LENGTH 8 DECIMALS 2. - - CLASS lcl_bowling DEFINITION. - PUBLIC SECTION. - METHODS calculate - IMPORTING - iv_players TYPE i - iv_games TYPE i - iv_day TYPE i - iv_shoes TYPE abap_bool - EXPORTING - ev_fee TYPE decfloat34 - ev_note TYPE string. - PRIVATE SECTION. - CONSTANTS: - c_lane_size TYPE i VALUE 6, - c_group_size TYPE i VALUE 12, - c_rate_weekday TYPE ty_rate VALUE '3.50', - c_rate_weekend TYPE ty_rate VALUE '5.00', - c_shoe_price TYPE ty_rate VALUE '2.00', - c_group_discount TYPE ty_rate VALUE '10.00'. - METHODS lanes_for - IMPORTING iv_players TYPE i - RETURNING VALUE(rv_lanes) TYPE i. - METHODS rate_for - IMPORTING iv_day TYPE i - RETURNING VALUE(rv_rate) TYPE ty_rate. - ENDCLASS. - - CLASS lcl_bowling IMPLEMENTATION. - METHOD calculate. - DATA(lv_lanes) = lanes_for( iv_players ). - DATA(lv_rate) = rate_for( iv_day ). - DATA lv_sum TYPE p LENGTH 15 DECIMALS 2. - lv_sum = lv_lanes * iv_games * lv_rate. - IF iv_shoes = abap_true. - lv_sum = lv_sum + iv_players * c_shoe_price. - ENDIF. - ev_note = 'BOOKED'. - IF iv_players >= c_group_size. - lv_sum = lv_sum - c_group_discount. - ev_note = 'GROUP'. - ENDIF. - ev_fee = lv_sum. - ENDMETHOD. - - METHOD lanes_for. - rv_lanes = iv_players DIV c_lane_size. - IF iv_players MOD c_lane_size > 0. - rv_lanes = rv_lanes + 1. - ENDIF. - ENDMETHOD. - - METHOD rate_for. - IF iv_day > 5. - rv_rate = c_rate_weekend. - ELSE. - rv_rate = c_rate_weekday. - ENDIF. - ENDMETHOD. - ENDCLASS. - - IF iv_players < 1 OR iv_games < 1. - RAISE invalid_input. - ENDIF. - - DATA(lo_bowling) = NEW lcl_bowling( ). - lo_bowling->calculate( - EXPORTING - iv_players = iv_players - iv_games = iv_games - iv_day = iv_day - iv_shoes = iv_shoes - IMPORTING - ev_fee = ev_fee - ev_note = ev_note ). - -ENDFUNCTION. diff --git a/tasks_gen/eval/G0143/reference/crane_test.clas.abap b/tasks_gen/eval/G0143/reference/crane_test.clas.abap new file mode 100644 index 0000000..73d11bb --- /dev/null +++ b/tasks_gen/eval/G0143/reference/crane_test.clas.abap @@ -0,0 +1,71 @@ +CLASS {{p}}crane_test DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS fee_for + IMPORTING iv_type TYPE string + iv_hours TYPE decfloat34 + iv_km TYPE i + iv_weekend TYPE abap_bool + iv_customer TYPE string + RETURNING VALUE(rv_total) TYPE decfloat34. + METHODS small_crane FOR TESTING. + METHODS weekend_and_gold FOR TESTING. + METHODS travel_cap FOR TESTING. + METHODS invalid_input FOR TESTING. +ENDCLASS. + + +CLASS {{p}}crane_test IMPLEMENTATION. + METHOD fee_for. + CALL FUNCTION '{{P}}CRANE_FEE_OLD' + EXPORTING + iv_crane_type = iv_type + iv_hours = iv_hours + iv_distance_km = iv_km + iv_weekend = iv_weekend + iv_customer = iv_customer + IMPORTING + ev_total = rv_total + EXCEPTIONS + invalid_crane_type = 1 + invalid_hours = 2 + OTHERS = 3. + cl_abap_unit_assert=>assert_subrc( exp = 0 ). + ENDMETHOD. + + METHOD small_crane. + cl_abap_unit_assert=>assert_equals( + exp = CONV decfloat34( 230 ) + act = fee_for( iv_type = 'SM' iv_hours = 2 iv_km = 0 iv_weekend = abap_false iv_customer = 'STD' ) ). + ENDMETHOD. + + METHOD weekend_and_gold. + cl_abap_unit_assert=>assert_equals( + exp = CONV decfloat34( '655.88' ) + act = fee_for( iv_type = 'MD' iv_hours = 3 iv_km = 20 iv_weekend = abap_true iv_customer = 'GOLD' ) ). + ENDMETHOD. + + METHOD travel_cap. + cl_abap_unit_assert=>assert_equals( + exp = CONV decfloat34( 240 ) + act = fee_for( iv_type = 'SM' iv_hours = 1 iv_km = 200 iv_weekend = abap_false iv_customer = 'STD' ) ). + ENDMETHOD. + + METHOD invalid_input. + DATA lv_total TYPE decfloat34. + CALL FUNCTION '{{P}}CRANE_FEE_OLD' + EXPORTING + iv_crane_type = 'XX' + iv_hours = 1 + iv_distance_km = 0 + iv_weekend = abap_false + iv_customer = 'STD' + IMPORTING + ev_total = lv_total + EXCEPTIONS + invalid_crane_type = 1 + invalid_hours = 2 + OTHERS = 3. + cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0143/reference/t14_test.clas.abap b/tasks_gen/eval/G0143/reference/t14_test.clas.abap deleted file mode 100644 index 55ca415..0000000 --- a/tasks_gen/eval/G0143/reference/t14_test.clas.abap +++ /dev/null @@ -1,74 +0,0 @@ -CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - METHODS weekday_fee FOR TESTING. - METHODS weekend_fee FOR TESTING. - METHODS group_fee FOR TESTING. - METHODS invalid_input FOR TESTING. -ENDCLASS. - -CLASS {{p}}t14_test IMPLEMENTATION. - METHOD weekday_fee. - DATA lv_fee TYPE decfloat34. - CALL FUNCTION '{{P}}BOWL_FEE_OLD' - EXPORTING - iv_players = 1 - iv_games = 1 - iv_day = 1 - IMPORTING - ev_fee = lv_fee - EXCEPTIONS - invalid_input = 1 - OTHERS = 2. - cl_abap_unit_assert=>assert_subrc( exp = 0 ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '3.50' ) act = lv_fee ). - ENDMETHOD. - - METHOD weekend_fee. - DATA lv_fee TYPE decfloat34. - CALL FUNCTION '{{P}}BOWL_FEE_OLD' - EXPORTING - iv_players = 6 - iv_games = 2 - iv_day = 6 - IMPORTING - ev_fee = lv_fee - EXCEPTIONS - invalid_input = 1 - OTHERS = 2. - cl_abap_unit_assert=>assert_subrc( exp = 0 ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.00' ) act = lv_fee ). - ENDMETHOD. - - METHOD group_fee. - DATA lv_fee TYPE decfloat34. - CALL FUNCTION '{{P}}BOWL_FEE_OLD' - EXPORTING - iv_players = 12 - iv_games = 1 - iv_day = 1 - iv_shoes = abap_true - IMPORTING - ev_fee = lv_fee - EXCEPTIONS - invalid_input = 1 - OTHERS = 2. - cl_abap_unit_assert=>assert_subrc( exp = 0 ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '21.00' ) act = lv_fee ). - ENDMETHOD. - - METHOD invalid_input. - DATA lv_fee TYPE decfloat34. - CALL FUNCTION '{{P}}BOWL_FEE_OLD' - EXPORTING - iv_players = 0 - iv_games = 1 - iv_day = 1 - IMPORTING - ev_fee = lv_fee - EXCEPTIONS - invalid_input = 1 - OTHERS = 2. - cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0143/seed/bowl_fee_old.func.abap b/tasks_gen/eval/G0143/seed/bowl_fee_old.func.abap deleted file mode 100644 index 3a04bdf..0000000 --- a/tasks_gen/eval/G0143/seed/bowl_fee_old.func.abap +++ /dev/null @@ -1,50 +0,0 @@ -FUNCTION {{p}}bowl_fee_old - IMPORTING - iv_players TYPE i - iv_games TYPE i - iv_day TYPE i - iv_shoes TYPE abap_bool - EXPORTING - ev_fee TYPE decfloat34 - ev_note TYPE string - EXCEPTIONS - invalid_input. - - DATA: lv_lanes TYPE i, - lv_rate TYPE p LENGTH 8 DECIMALS 2, - lv_sum TYPE p LENGTH 15 DECIMALS 2. - - IF iv_players < 1. - RAISE invalid_input. - ENDIF. - IF iv_games < 1. - RAISE invalid_input. - ENDIF. - - COMPUTE lv_lanes = iv_players DIV 6. - IF iv_players MOD 6 > 0. - ADD 1 TO lv_lanes. - ENDIF. - - IF iv_day > 5. - MOVE '5.00' TO lv_rate. - ELSE. - MOVE '3.50' TO lv_rate. - ENDIF. - - COMPUTE lv_sum = lv_lanes * iv_games * lv_rate. - - IF iv_shoes = 'X'. - COMPUTE lv_sum = lv_sum + iv_players * '2.00'. - ENDIF. - - ev_note = 'BOOKED'. - - IF iv_players >= 12. - COMPUTE lv_sum = lv_sum - '10.00'. - ev_note = 'GROUP'. - ENDIF. - - ev_fee = lv_sum. - -ENDFUNCTION. diff --git a/tasks_gen/eval/G0143/seed/crane_fee_old.func.abap b/tasks_gen/eval/G0143/seed/crane_fee_old.func.abap new file mode 100644 index 0000000..3c05465 --- /dev/null +++ b/tasks_gen/eval/G0143/seed/crane_fee_old.func.abap @@ -0,0 +1,71 @@ +FUNCTION {{p}}crane_fee_old + IMPORTING + iv_crane_type TYPE string + iv_hours TYPE decfloat34 + iv_distance_km TYPE i + iv_weekend TYPE abap_bool + iv_customer TYPE string + EXPORTING + ev_base_fee TYPE decfloat34 + ev_travel_fee TYPE decfloat34 + ev_surcharge TYPE decfloat34 + ev_discount TYPE decfloat34 + ev_total TYPE decfloat34 + EXCEPTIONS + invalid_crane_type + invalid_hours. + + DATA lv_hourly TYPE decfloat34. + DATA lv_per_km TYPE decfloat34. + DATA lv_km TYPE i. + DATA lv_sum TYPE decfloat34. + + IF iv_hours <= 0. + RAISE invalid_hours. + ENDIF. + + CASE iv_crane_type. + WHEN 'SM'. + lv_hourly = 115. + lv_per_km = '1.25'. + WHEN 'MD'. + lv_hourly = 185. + lv_per_km = '1.75'. + WHEN 'LG'. + lv_hourly = 345. + lv_per_km = '2.35'. + WHEN OTHERS. + RAISE invalid_crane_type. + ENDCASE. + + ev_base_fee = iv_hours * lv_hourly. + + lv_km = iv_distance_km. + IF lv_km > 100. + lv_km = 100. + ENDIF. + ev_travel_fee = lv_km * lv_per_km. + + IF iv_weekend = abap_true. + ev_surcharge = ev_base_fee * 25 / 100. + ELSE. + ev_surcharge = 0. + ENDIF. + + lv_sum = ev_base_fee + ev_travel_fee + ev_surcharge. + + IF iv_customer = 'GOLD'. + ev_discount = lv_sum * 10 / 100. + ELSE. + ev_discount = 0. + ENDIF. + + ev_total = lv_sum - ev_discount. + + ev_base_fee = round( val = ev_base_fee dec = 2 mode = cl_abap_math=>round_half_up ). + ev_travel_fee = round( val = ev_travel_fee dec = 2 mode = cl_abap_math=>round_half_up ). + ev_surcharge = round( val = ev_surcharge dec = 2 mode = cl_abap_math=>round_half_up ). + ev_discount = round( val = ev_discount dec = 2 mode = cl_abap_math=>round_half_up ). + ev_total = round( val = ev_total dec = 2 mode = cl_abap_math=>round_half_up ). + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0143/spec.md b/tasks_gen/eval/G0143/spec.md index 9181376..215bb10 100644 --- a/tasks_gen/eval/G0143/spec.md +++ b/tasks_gen/eval/G0143/spec.md @@ -1,36 +1,48 @@ # 1. Goal -Refactor the legacy function module {{P}}BOWL_FEE_OLD in place. The behavior must -stay the same. Improve the code quality so that the module is easier to maintain. +Refactor the legacy function module {{P}}CRANE_FEE_OLD in function group +{{P}}FG_CRANE. The function module calculates the fee of a crane hire job. The +refactoring must improve the quality of the code. The behavior stays the same. +The name and the public interface stay the same. # 2. Open questions None. # 3. Context -- Function group {{P}}FG_BOWL exists in package $TMP. -- Function module {{P}}BOWL_FEE_OLD exists in this group. It is the legacy - implementation of the bowling fee calculation. -- The booking program calls this function module. The interface must not change. +- Function group {{P}}FG_CRANE exists in package $TMP. +- Function module {{P}}CRANE_FEE_OLD exists in this group. It is the legacy + implementation of the fee calculation. Read its source. The source defines + the fee rules of the crane hire company. +- A crane hire company uses the function module to price jobs. The dispatcher + enters the crane type, the number of hours, the distance in kilometres, + whether the job is on a weekend, and the customer category. The function + module returns the base fee, the travel fee, the surcharge, the discount, and + the total fee. # 4. Contract -- Refactor the function module {{P}}BOWL_FEE_OLD in function group {{P}}FG_BOWL. -- Keep the exact interface: the same parameter names, types, and exceptions. -- The function module name stays the same. +- Refactor the function module {{P}}CRANE_FEE_OLD in function group + {{P}}FG_CRANE in place. +- Keep the name and the public interface exactly as they are. +- The interface is: + - Importing: iv_crane_type TYPE string, iv_hours TYPE decfloat34, + iv_distance_km TYPE i, iv_weekend TYPE abap_bool, iv_customer TYPE string. + - Exporting: ev_base_fee TYPE decfloat34, ev_travel_fee TYPE decfloat34, + ev_surcharge TYPE decfloat34, ev_discount TYPE decfloat34, + ev_total TYPE decfloat34. + - Exceptions: invalid_crane_type, invalid_hours. # 5. Business rules -The business rules are defined by the current behavior of the legacy code. -Read the legacy source code in {{P}}BOWL_FEE_OLD. The refactored function module -must produce exactly the same results as the legacy code for every input. -Do not change any rule. +The behavior of the current implementation is the specification. The +refactored function module must return exactly the same values as the current +implementation for every input. Read the legacy source carefully to learn the +rules. Do not change the behavior. # 6. Constraints -- Release target: SAP_BASIS 816. -- Coding standards: Clean ABAP. Use modern ABAP syntax. No obsolete statements - (for example COMPUTE, MOVE, ADD ... TO ...). Methods below 40 statements. - Pass large parameters by reference. No ATC priority 1 or 2 findings. -- Out of scope: do not change the function group {{P}}FG_BOWL. Do not change - the function module interface. +- Release target: 7.58. +- Coding standards: Clean ABAP. Methods must be shorter than 40 statements. + Pass large parameters by reference. +- Out of scope: do not change the function group {{P}}FG_CRANE. # 7. Acceptance -- The function module is active and has no syntax error. +- The function module {{P}}CRANE_FEE_OLD is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests for the function module in a global test class. diff --git a/tasks_gen/eval/G0143/task.json b/tasks_gen/eval/G0143/task.json index 8482244..ce61618 100644 --- a/tasks_gen/eval/G0143/task.json +++ b/tasks_gen/eval/G0143/task.json @@ -3,7 +3,7 @@ "category": "E", "object_type": "FUNC", "difficulty": 2, - "release_target": "v816", + "release_target": "v758", "expected_outcome": "implement", "budget": { "max_tool_calls": 60, @@ -12,72 +12,83 @@ "seed": [ { "type": "FUGR", - "name": "{{P}}FG_BOWL", - "description": "Bowling fee function group" + "name": "{{P}}FG_CRANE", + "description": "Crane hire function group" }, { "type": "FUNC", - "name": "{{P}}BOWL_FEE_OLD", - "functionGroup": "{{P}}FG_BOWL", - "file": "seed/bowl_fee_old.func.abap", - "description": "Legacy bowling fee calculation" + "name": "{{P}}CRANE_FEE_OLD", + "functionGroup": "{{P}}FG_CRANE", + "file": "seed/crane_fee_old.func.abap", + "description": "Legacy crane fee calculation" } ], "contract": [ { "type": "FUNC", - "name": "{{P}}BOWL_FEE_OLD", - "functionGroup": "{{P}}FG_BOWL", + "name": "{{P}}CRANE_FEE_OLD", + "functionGroup": "{{P}}FG_CRANE", "params": [ { - "name": "iv_players", - "type": "i" + "name": "iv_crane_type", + "type": "string" }, { - "name": "iv_games", - "type": "i" - }, - { - "name": "iv_day", - "type": "i" - }, - { - "name": "iv_shoes", - "type": "abap_bool" - }, - { - "name": "ev_fee", + "name": "iv_hours", "type": "decfloat34" }, { - "name": "ev_note", + "name": "iv_distance_km", + "type": "i" + }, + { + "name": "iv_weekend", + "type": "abap_bool" + }, + { + "name": "iv_customer", "type": "string" + }, + { + "name": "ev_base_fee", + "type": "decfloat34" + }, + { + "name": "ev_travel_fee", + "type": "decfloat34" + }, + { + "name": "ev_surcharge", + "type": "decfloat34" + }, + { + "name": "ev_discount", + "type": "decfloat34" + }, + { + "name": "ev_total", + "type": "decfloat34" } ] } ], - "out_of_scope": [], + "out_of_scope": [ + "{{P}}FG_CRANE" + ], "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}T14_HIDDEN", - "file": "hidden/t14_hidden.clas.abap", - "description": "T14 hidden tests" + "name": "{{P}}CRANE_HIDDEN", + "file": "hidden/crane_hidden.clas.abap", + "description": "Hidden behaviour tests for the crane fee" } ], "reference": [ - { - "type": "FUNC", - "name": "{{P}}BOWL_FEE_OLD", - "functionGroup": "{{P}}FG_BOWL", - "file": "reference/bowl_fee_old.func.abap", - "description": "Refactored bowling fee calculation" - }, { "type": "CLAS", - "name": "{{P}}T14_TEST", - "file": "reference/t14_test.clas.abap", - "description": "T14 own tests" + "name": "{{P}}CRANE_TEST", + "file": "reference/crane_test.clas.abap", + "description": "Own tests for the crane fee" } ], "craft_checks": [ diff --git a/tasks_gen/eval/G0144/generation.json b/tasks_gen/eval/G0144/generation.json new file mode 100644 index 0000000..a5b846b --- /dev/null +++ b/tasks_gen/eval/G0144/generation.json @@ -0,0 +1,45 @@ +{ + "id": "G0144", + "pool": "eval", + "object_type": "FUNC", + "category": "E", + "attempts": [ + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "bundle", + "errors": [ + "category E: the contract object must be the seed object that the model changes in place (same name in seed, contract and reference)" + ], + "by_check": { + "static": 1 + } + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "revalidate", + "by": "harness fix 2026-10-03", + "change": "ADT activation fallback for a second FUNC write. Bundle not changed.", + "oracle": 0, + "null": 0, + "mutation": { + "valid": 0, + "killed": 0, + "ok": false + } + } + ], + "accepted": false +} \ No newline at end of file diff --git a/tasks_gen/eval/G0144/hidden/cine_hidden.clas.abap b/tasks_gen/eval/G0144/hidden/cine_hidden.clas.abap deleted file mode 100644 index 57b7e58..0000000 --- a/tasks_gen/eval/G0144/hidden/cine_hidden.clas.abap +++ /dev/null @@ -1,135 +0,0 @@ -CLASS {{p}}cine_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - CONSTANTS: c_evening TYPE t VALUE '200000', - c_matinee TYPE t VALUE '160000', - c_boundary TYPE t VALUE '170000', - c_morning TYPE t VALUE '100000'. - - METHODS call_fee - IMPORTING iv_show TYPE string - iv_seats TYPE i - iv_time TYPE t - iv_cust TYPE string - EXPORTING ev_total TYPE decfloat34 - ev_disc TYPE decfloat34 - ev_subrc TYPE sysubrc. - - METHODS base_price_2d FOR TESTING. - METHODS base_prices_3d_imax FOR TESTING. - METHODS invalid_seats FOR TESTING. - METHODS invalid_show_type FOR TESTING. - METHODS invalid_cust_type FOR TESTING. - METHODS matinee_discount FOR TESTING. - METHODS matinee_boundary FOR TESTING. - METHODS child_skips_matinee FOR TESTING. - METHODS group_threshold FOR TESTING. - METHODS discount_cap FOR TESTING. - METHODS rounding_half_up FOR TESTING. -ENDCLASS. - - -CLASS {{p}}cine_hidden IMPLEMENTATION. - - METHOD call_fee. - ev_total = 0. - ev_disc = 0. - CALL FUNCTION '{{P}}CINE_FEE_OLD' - EXPORTING - iv_show_type = iv_show - iv_seats = iv_seats - iv_show_time = iv_time - iv_cust_type = iv_cust - IMPORTING - ev_total = ev_total - ev_discount = ev_disc - EXCEPTIONS - invalid_input = 1 - OTHERS = 2. - ev_subrc = sy-subrc. - ENDMETHOD. - - METHOD base_price_2d. - call_fee( EXPORTING iv_show = `2D` iv_seats = 1 iv_time = c_evening iv_cust = `ADULT` - IMPORTING ev_total = DATA(lv_total) ev_disc = DATA(lv_disc) ev_subrc = DATA(lv_rc) ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '9.50' ) act = lv_total ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_disc ). - ENDMETHOD. - - METHOD base_prices_3d_imax. - call_fee( EXPORTING iv_show = `3D` iv_seats = 1 iv_time = c_evening iv_cust = `ADULT` - IMPORTING ev_total = DATA(lv_total) ev_subrc = DATA(lv_rc) ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '13.00' ) act = lv_total ). - - call_fee( EXPORTING iv_show = `IMAX` iv_seats = 1 iv_time = c_evening iv_cust = `ADULT` - IMPORTING ev_total = DATA(lv_total2) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '16.50' ) act = lv_total2 ). - ENDMETHOD. - - METHOD invalid_seats. - call_fee( EXPORTING iv_show = `2D` iv_seats = 0 iv_time = c_evening iv_cust = `ADULT` - IMPORTING ev_subrc = DATA(lv_rc) ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). - ENDMETHOD. - - METHOD invalid_show_type. - call_fee( EXPORTING iv_show = `XX` iv_seats = 1 iv_time = c_evening iv_cust = `ADULT` - IMPORTING ev_subrc = DATA(lv_rc) ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). - ENDMETHOD. - - METHOD invalid_cust_type. - call_fee( EXPORTING iv_show = `2D` iv_seats = 1 iv_time = c_evening iv_cust = `VIP` - IMPORTING ev_subrc = DATA(lv_rc) ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). - ENDMETHOD. - - METHOD matinee_discount. - call_fee( EXPORTING iv_show = `2D` iv_seats = 1 iv_time = c_matinee iv_cust = `ADULT` - IMPORTING ev_total = DATA(lv_total) ev_disc = DATA(lv_disc) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '7.25' ) act = lv_total ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 25 ) act = lv_disc ). - ENDMETHOD. - - METHOD matinee_boundary. - call_fee( EXPORTING iv_show = `2D` iv_seats = 1 iv_time = c_boundary iv_cust = `ADULT` - IMPORTING ev_total = DATA(lv_total) ev_disc = DATA(lv_disc) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '9.50' ) act = lv_total ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_disc ). - ENDMETHOD. - - METHOD child_skips_matinee. - call_fee( EXPORTING iv_show = `2D` iv_seats = 1 iv_time = c_morning iv_cust = `CHILD` - IMPORTING ev_total = DATA(lv_total) ev_disc = DATA(lv_disc) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '5.90' ) act = lv_total ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 40 ) act = lv_disc ). - ENDMETHOD. - - METHOD group_threshold. - call_fee( EXPORTING iv_show = `2D` iv_seats = 7 iv_time = c_evening iv_cust = `ADULT` - IMPORTING ev_total = DATA(lv_total) ev_disc = DATA(lv_disc) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '66.50' ) act = lv_total ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_disc ). - - call_fee( EXPORTING iv_show = `2D` iv_seats = 8 iv_time = c_evening iv_cust = `ADULT` - IMPORTING ev_total = DATA(lv_total2) ev_disc = DATA(lv_disc2) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '68.80' ) act = lv_total2 ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10 ) act = lv_disc2 ). - ENDMETHOD. - - METHOD discount_cap. - call_fee( EXPORTING iv_show = `2D` iv_seats = 8 iv_time = c_morning iv_cust = `SENIOR` - IMPORTING ev_total = DATA(lv_total) ev_disc = DATA(lv_disc) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '32.80' ) act = lv_total ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 60 ) act = lv_disc ). - ENDMETHOD. - - METHOD rounding_half_up. - call_fee( EXPORTING iv_show = `3D` iv_seats = 3 iv_time = c_matinee iv_cust = `ADULT` - IMPORTING ev_total = DATA(lv_total) ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '29.63' ) act = lv_total ). - ENDMETHOD. - -ENDCLASS. diff --git a/tasks_gen/eval/G0144/hidden/t_ski_hidden.clas.abap b/tasks_gen/eval/G0144/hidden/t_ski_hidden.clas.abap new file mode 100644 index 0000000..ecbae57 --- /dev/null +++ b/tasks_gen/eval/G0144/hidden/t_ski_hidden.clas.abap @@ -0,0 +1,102 @@ +CLASS {{p}}t_ski_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS call + IMPORTING iv_equipment TYPE string + iv_days TYPE i + iv_customer TYPE string + iv_insurance TYPE abap_bool + EXPORTING ev_price TYPE decfloat34 + ev_deposit TYPE decfloat34 + ev_subrc TYPE sysubrc. + METHODS invalid_days FOR TESTING. + METHODS invalid_equipment FOR TESTING. + METHODS invalid_customer FOR TESTING. + METHODS adult_ski_one_day FOR TESTING. + METHODS child_boots_two_days FOR TESTING. + METHODS senior_snowboard_3d FOR TESTING. + METHODS adult_ski_7d_insurance FOR TESTING. + METHODS child_helmet_10d_ins FOR TESTING. + METHODS rounding_case FOR TESTING. +ENDCLASS. + + +CLASS {{p}}t_ski_hidden IMPLEMENTATION. + METHOD call. + CALL FUNCTION '{{P}}SKI_RENTAL_OLD' + EXPORTING + iv_equipment = iv_equipment + iv_days = iv_days + iv_customer = iv_customer + iv_insurance = iv_insurance + IMPORTING + ev_price = ev_price + ev_deposit = ev_deposit + EXCEPTIONS + invalid_equipment = 1 + invalid_days = 2 + invalid_customer = 3 + OTHERS = 4. + ev_subrc = sy-subrc. + ENDMETHOD. + + METHOD invalid_days. + call( EXPORTING iv_equipment = 'SKI' iv_days = 0 iv_customer = 'ADULT' iv_insurance = abap_false + IMPORTING ev_subrc = DATA(lv_subrc) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_subrc ). + ENDMETHOD. + + METHOD invalid_equipment. + call( EXPORTING iv_equipment = 'X' iv_days = 1 iv_customer = 'ADULT' iv_insurance = abap_false + IMPORTING ev_subrc = DATA(lv_subrc) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ). + ENDMETHOD. + + METHOD invalid_customer. + call( EXPORTING iv_equipment = 'SKI' iv_days = 1 iv_customer = 'X' iv_insurance = abap_false + IMPORTING ev_subrc = DATA(lv_subrc) ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_subrc ). + ENDMETHOD. + + METHOD adult_ski_one_day. + call( EXPORTING iv_equipment = 'SKI' iv_days = 1 iv_customer = 'ADULT' iv_insurance = abap_false + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 25 ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = lv_deposit ). + ENDMETHOD. + + METHOD child_boots_two_days. + call( EXPORTING iv_equipment = 'BOOTS' iv_days = 2 iv_customer = 'CHILD' iv_insurance = abap_false + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10 ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 20 ) act = lv_deposit ). + ENDMETHOD. + + METHOD senior_snowboard_3d. + call( EXPORTING iv_equipment = 'SNOWBOARD' iv_days = 3 iv_customer = 'SENIOR' iv_insurance = abap_false + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '68.40' ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 120 ) act = lv_deposit ). + ENDMETHOD. + + METHOD adult_ski_7d_insurance. + call( EXPORTING iv_equipment = 'SKI' iv_days = 7 iv_customer = 'ADULT' iv_insurance = abap_true + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '192.50' ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 150 ) act = lv_deposit ). + ENDMETHOD. + + METHOD child_helmet_10d_ins. + call( EXPORTING iv_equipment = 'HELMET' iv_days = 10 iv_customer = 'CHILD' iv_insurance = abap_true + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '72.50' ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 60 ) act = lv_deposit ). + ENDMETHOD. + + METHOD rounding_case. + call( EXPORTING iv_equipment = 'SKI' iv_days = 3 iv_customer = 'CHILD' iv_insurance = abap_false + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '35.63' ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = lv_deposit ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0144/reference/cine_fee_old.func.abap b/tasks_gen/eval/G0144/reference/cine_fee_old.func.abap deleted file mode 100644 index 31d87af..0000000 --- a/tasks_gen/eval/G0144/reference/cine_fee_old.func.abap +++ /dev/null @@ -1,77 +0,0 @@ -FUNCTION {{p}}cine_fee_old - IMPORTING - iv_show_type TYPE string - iv_seats TYPE i - iv_show_time TYPE t - iv_cust_type TYPE string - EXPORTING - ev_total TYPE decfloat34 - ev_discount TYPE decfloat34 - EXCEPTIONS - invalid_input. - - CONSTANTS: - c_price_2d TYPE decfloat34 VALUE '9.00', - c_price_3d TYPE decfloat34 VALUE '12.50', - c_price_imax TYPE decfloat34 VALUE '16.00', - c_booking_fee TYPE decfloat34 VALUE '0.50', - c_percent TYPE decfloat34 VALUE 100, - c_disc_child TYPE decfloat34 VALUE 40, - c_disc_senior TYPE decfloat34 VALUE 30, - c_disc_student TYPE decfloat34 VALUE 20, - c_disc_matinee TYPE decfloat34 VALUE 25, - c_disc_group TYPE decfloat34 VALUE 10, - c_disc_max TYPE decfloat34 VALUE 60, - c_group_seats TYPE i VALUE 8, - c_matinee_end TYPE t VALUE '170000'. - - DATA: lv_base TYPE decfloat34, - lv_discount TYPE decfloat34, - lv_price TYPE decfloat34. - - IF iv_seats < 1. - RAISE invalid_input. - ENDIF. - - CASE iv_show_type. - WHEN '2D'. - lv_base = c_price_2d. - WHEN '3D'. - lv_base = c_price_3d. - WHEN 'IMAX'. - lv_base = c_price_imax. - WHEN OTHERS. - RAISE invalid_input. - ENDCASE. - - CASE iv_cust_type. - WHEN 'CHILD'. - lv_discount = c_disc_child. - WHEN 'SENIOR'. - lv_discount = c_disc_senior. - WHEN 'STUDENT'. - lv_discount = c_disc_student. - WHEN 'ADULT'. - lv_discount = 0. - WHEN OTHERS. - RAISE invalid_input. - ENDCASE. - - IF iv_show_time < c_matinee_end AND iv_cust_type <> 'CHILD'. - lv_discount = lv_discount + c_disc_matinee. - ENDIF. - - IF iv_seats >= c_group_seats. - lv_discount = lv_discount + c_disc_group. - ENDIF. - - IF lv_discount > c_disc_max. - lv_discount = c_disc_max. - ENDIF. - - lv_price = lv_base - lv_base * lv_discount / c_percent + c_booking_fee. - - ev_total = round( val = lv_price * iv_seats dec = 2 mode = cl_abap_math=>round_half_up ). - ev_discount = lv_discount. - -ENDFUNCTION. diff --git a/tasks_gen/eval/G0144/reference/cine_test.clas.abap b/tasks_gen/eval/G0144/reference/cine_test.clas.abap deleted file mode 100644 index 946529e..0000000 --- a/tasks_gen/eval/G0144/reference/cine_test.clas.abap +++ /dev/null @@ -1,72 +0,0 @@ -CLASS {{p}}cine_test DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - CONSTANTS: c_evening TYPE t VALUE '200000', - c_matinee TYPE t VALUE '160000'. - - METHODS fee - IMPORTING iv_show TYPE string - iv_seats TYPE i - iv_time TYPE t - iv_cust TYPE string - RETURNING VALUE(rv_total) TYPE decfloat34. - - METHODS adult_evening FOR TESTING. - METHODS matinee_discount FOR TESTING. - METHODS child_price FOR TESTING. - METHODS invalid_seats FOR TESTING. -ENDCLASS. - - -CLASS {{p}}cine_test IMPLEMENTATION. - - METHOD fee. - CALL FUNCTION '{{P}}CINE_FEE_OLD' - EXPORTING - iv_show_type = iv_show - iv_seats = iv_seats - iv_show_time = iv_time - iv_cust_type = iv_cust - IMPORTING - ev_total = rv_total - EXCEPTIONS - invalid_input = 1 - OTHERS = 2. - cl_abap_unit_assert=>assert_subrc( exp = 0 ). - ENDMETHOD. - - METHOD adult_evening. - cl_abap_unit_assert=>assert_equals( - exp = CONV decfloat34( '9.50' ) - act = fee( iv_show = `2D` iv_seats = 1 iv_time = c_evening iv_cust = `ADULT` ) ). - ENDMETHOD. - - METHOD matinee_discount. - cl_abap_unit_assert=>assert_equals( - exp = CONV decfloat34( '7.25' ) - act = fee( iv_show = `2D` iv_seats = 1 iv_time = c_matinee iv_cust = `ADULT` ) ). - ENDMETHOD. - - METHOD child_price. - cl_abap_unit_assert=>assert_equals( - exp = CONV decfloat34( '5.90' ) - act = fee( iv_show = `2D` iv_seats = 1 iv_time = c_matinee iv_cust = `CHILD` ) ). - ENDMETHOD. - - METHOD invalid_seats. - DATA lv_total TYPE decfloat34. - CALL FUNCTION '{{P}}CINE_FEE_OLD' - EXPORTING - iv_show_type = `2D` - iv_seats = 0 - iv_show_time = c_evening - iv_cust_type = `ADULT` - IMPORTING - ev_total = lv_total - EXCEPTIONS - invalid_input = 1 - OTHERS = 2. - cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ). - ENDMETHOD. - -ENDCLASS. diff --git a/tasks_gen/eval/G0144/reference/ski_rental_old.func.abap b/tasks_gen/eval/G0144/reference/ski_rental_old.func.abap new file mode 100644 index 0000000..101f0d2 --- /dev/null +++ b/tasks_gen/eval/G0144/reference/ski_rental_old.func.abap @@ -0,0 +1,166 @@ +FUNCTION {{p}}ski_rental_old + IMPORTING + iv_equipment TYPE string + iv_days TYPE i + iv_customer TYPE string + iv_insurance TYPE abap_bool + EXPORTING + ev_price TYPE decfloat34 + ev_deposit TYPE decfloat34 + EXCEPTIONS + invalid_equipment + invalid_days + invalid_customer. + + CLASS lcx_invalid_equipment DEFINITION INHERITING FROM cx_static_check. + ENDCLASS. + CLASS lcx_invalid_equipment IMPLEMENTATION. + ENDCLASS. + + CLASS lcx_invalid_days DEFINITION INHERITING FROM cx_static_check. + ENDCLASS. + CLASS lcx_invalid_days IMPLEMENTATION. + ENDCLASS. + + CLASS lcx_invalid_customer DEFINITION INHERITING FROM cx_static_check. + ENDCLASS. + CLASS lcx_invalid_customer IMPLEMENTATION. + ENDCLASS. + + CLASS lcl_ski_pricer DEFINITION. + PUBLIC SECTION. + TYPES: BEGIN OF ty_result, + price TYPE decfloat34, + deposit TYPE decfloat34, + END OF ty_result. + CLASS-METHODS calculate + IMPORTING iv_equipment TYPE string + iv_days TYPE i + iv_customer TYPE string + iv_insurance TYPE abap_bool + RETURNING VALUE(rs_result) TYPE ty_result + RAISING lcx_invalid_equipment lcx_invalid_days lcx_invalid_customer. + PRIVATE SECTION. + CLASS-METHODS get_daily_rate + IMPORTING iv_equipment TYPE string + RETURNING VALUE(rv_rate) TYPE decfloat34 + RAISING lcx_invalid_equipment. + CLASS-METHODS get_deposit + IMPORTING iv_equipment TYPE string + RETURNING VALUE(rv_deposit) TYPE decfloat34 + RAISING lcx_invalid_equipment. + CLASS-METHODS get_customer_discount + IMPORTING iv_customer TYPE string + RETURNING VALUE(rv_discount) TYPE decfloat34 + RAISING lcx_invalid_customer. + CLASS-METHODS get_duration_discount + IMPORTING iv_days TYPE i + RETURNING VALUE(rv_discount) TYPE decfloat34. + ENDCLASS. + + CLASS lcl_ski_pricer IMPLEMENTATION. + METHOD calculate. + CONSTANTS: c_insurance_per_day TYPE decfloat34 VALUE 5, + c_insurance_deposit TYPE decfloat34 VALUE 50. + IF iv_days < 1. + RAISE EXCEPTION TYPE lcx_invalid_days. + ENDIF. + DATA(lv_daily_rate) = get_daily_rate( iv_equipment ). + DATA(lv_customer_disc) = get_customer_discount( iv_customer ). + DATA(lv_total) = lv_daily_rate * iv_days. + lv_total = lv_total - lv_total * lv_customer_disc / 100. + DATA(lv_duration_disc) = get_duration_discount( iv_days ). + lv_total = lv_total - lv_total * lv_duration_disc / 100. + IF iv_insurance = abap_true. + lv_total = lv_total + c_insurance_per_day * iv_days. + ENDIF. + rs_result-price = round( val = lv_total dec = 2 mode = cl_abap_math=>round_half_up ). + rs_result-deposit = get_deposit( iv_equipment ). + IF iv_insurance = abap_true. + rs_result-deposit = rs_result-deposit + c_insurance_deposit. + ENDIF. + ENDMETHOD. + + METHOD get_daily_rate. + CONSTANTS: c_ski_rate TYPE decfloat34 VALUE 25, + c_snowboard_rate TYPE decfloat34 VALUE 30, + c_boots_rate TYPE decfloat34 VALUE 10, + c_helmet_rate TYPE decfloat34 VALUE 5. + CASE iv_equipment. + WHEN 'SKI'. + rv_rate = c_ski_rate. + WHEN 'SNOWBOARD'. + rv_rate = c_snowboard_rate. + WHEN 'BOOTS'. + rv_rate = c_boots_rate. + WHEN 'HELMET'. + rv_rate = c_helmet_rate. + WHEN OTHERS. + RAISE EXCEPTION TYPE lcx_invalid_equipment. + ENDCASE. + ENDMETHOD. + + METHOD get_deposit. + CONSTANTS: c_ski_deposit TYPE decfloat34 VALUE 100, + c_snowboard_deposit TYPE decfloat34 VALUE 120, + c_boots_deposit TYPE decfloat34 VALUE 20, + c_helmet_deposit TYPE decfloat34 VALUE 10. + CASE iv_equipment. + WHEN 'SKI'. + rv_deposit = c_ski_deposit. + WHEN 'SNOWBOARD'. + rv_deposit = c_snowboard_deposit. + WHEN 'BOOTS'. + rv_deposit = c_boots_deposit. + WHEN 'HELMET'. + rv_deposit = c_helmet_deposit. + WHEN OTHERS. + RAISE EXCEPTION TYPE lcx_invalid_equipment. + ENDCASE. + ENDMETHOD. + + METHOD get_customer_discount. + CONSTANTS: c_child_discount TYPE decfloat34 VALUE 50, + c_senior_discount TYPE decfloat34 VALUE 20. + CASE iv_customer. + WHEN 'ADULT'. + rv_discount = 0. + WHEN 'CHILD'. + rv_discount = c_child_discount. + WHEN 'SENIOR'. + rv_discount = c_senior_discount. + WHEN OTHERS. + RAISE EXCEPTION TYPE lcx_invalid_customer. + ENDCASE. + ENDMETHOD. + + METHOD get_duration_discount. + CONSTANTS: c_disc_7 TYPE decfloat34 VALUE 10, + c_disc_3 TYPE decfloat34 VALUE 5. + IF iv_days >= 7. + rv_discount = c_disc_7. + ELSEIF iv_days >= 3. + rv_discount = c_disc_3. + ELSE. + rv_discount = 0. + ENDIF. + ENDMETHOD. + ENDCLASS. + + TRY. + DATA(ls_result) = lcl_ski_pricer=>calculate( + iv_equipment = iv_equipment + iv_days = iv_days + iv_customer = iv_customer + iv_insurance = iv_insurance ). + ev_price = ls_result-price. + ev_deposit = ls_result-deposit. + CATCH lcx_invalid_equipment. + RAISE invalid_equipment. + CATCH lcx_invalid_days. + RAISE invalid_days. + CATCH lcx_invalid_customer. + RAISE invalid_customer. + ENDTRY. + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0144/reference/t_ski_test.clas.abap b/tasks_gen/eval/G0144/reference/t_ski_test.clas.abap new file mode 100644 index 0000000..2d727a7 --- /dev/null +++ b/tasks_gen/eval/G0144/reference/t_ski_test.clas.abap @@ -0,0 +1,94 @@ +CLASS {{p}}t_ski_test DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS call + IMPORTING iv_equipment TYPE string + iv_days TYPE i + iv_customer TYPE string + iv_insurance TYPE abap_bool + EXPORTING ev_price TYPE decfloat34 + ev_deposit TYPE decfloat34 + ev_subrc TYPE sysubrc. + METHODS test_invalid_days FOR TESTING. + METHODS test_invalid_equipment FOR TESTING. + METHODS test_invalid_customer FOR TESTING. + METHODS test_adult_ski FOR TESTING. + METHODS test_child_boots FOR TESTING. + METHODS test_senior_snowboard FOR TESTING. + METHODS test_insurance FOR TESTING. + METHODS test_rounding FOR TESTING. +ENDCLASS. + + +CLASS {{p}}t_ski_test IMPLEMENTATION. + METHOD call. + CALL FUNCTION '{{P}}SKI_RENTAL_OLD' + EXPORTING + iv_equipment = iv_equipment + iv_days = iv_days + iv_customer = iv_customer + iv_insurance = iv_insurance + IMPORTING + ev_price = ev_price + ev_deposit = ev_deposit + EXCEPTIONS + invalid_equipment = 1 + invalid_days = 2 + invalid_customer = 3 + OTHERS = 4. + ev_subrc = sy-subrc. + ENDMETHOD. + + METHOD test_invalid_days. + call( EXPORTING iv_equipment = 'SKI' iv_days = 0 iv_customer = 'ADULT' iv_insurance = abap_false + IMPORTING ev_subrc = DATA(lv_subrc) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_subrc ). + ENDMETHOD. + + METHOD test_invalid_equipment. + call( EXPORTING iv_equipment = 'X' iv_days = 1 iv_customer = 'ADULT' iv_insurance = abap_false + IMPORTING ev_subrc = DATA(lv_subrc) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ). + ENDMETHOD. + + METHOD test_invalid_customer. + call( EXPORTING iv_equipment = 'SKI' iv_days = 1 iv_customer = 'X' iv_insurance = abap_false + IMPORTING ev_subrc = DATA(lv_subrc) ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_subrc ). + ENDMETHOD. + + METHOD test_adult_ski. + call( EXPORTING iv_equipment = 'SKI' iv_days = 1 iv_customer = 'ADULT' iv_insurance = abap_false + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 25 ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = lv_deposit ). + ENDMETHOD. + + METHOD test_child_boots. + call( EXPORTING iv_equipment = 'BOOTS' iv_days = 2 iv_customer = 'CHILD' iv_insurance = abap_false + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10 ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 20 ) act = lv_deposit ). + ENDMETHOD. + + METHOD test_senior_snowboard. + call( EXPORTING iv_equipment = 'SNOWBOARD' iv_days = 3 iv_customer = 'SENIOR' iv_insurance = abap_false + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '68.40' ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 120 ) act = lv_deposit ). + ENDMETHOD. + + METHOD test_insurance. + call( EXPORTING iv_equipment = 'SKI' iv_days = 7 iv_customer = 'ADULT' iv_insurance = abap_true + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '192.50' ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 150 ) act = lv_deposit ). + ENDMETHOD. + + METHOD test_rounding. + call( EXPORTING iv_equipment = 'SKI' iv_days = 3 iv_customer = 'CHILD' iv_insurance = abap_false + IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '35.63' ) act = lv_price ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = lv_deposit ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0144/seed/cine_fee_old.func.abap b/tasks_gen/eval/G0144/seed/cine_fee_old.func.abap deleted file mode 100644 index a60822c..0000000 --- a/tasks_gen/eval/G0144/seed/cine_fee_old.func.abap +++ /dev/null @@ -1,71 +0,0 @@ -FUNCTION {{p}}cine_fee_old - IMPORTING - iv_show_type TYPE string - iv_seats TYPE i - iv_show_time TYPE t - iv_cust_type TYPE string - EXPORTING - ev_total TYPE decfloat34 - ev_discount TYPE decfloat34 - EXCEPTIONS - invalid_input. - - " legacy: price per seat - DATA: lv_x TYPE decfloat34, - lv_y TYPE decfloat34, - lv_z TYPE i. - - IF iv_seats < 1. - RAISE invalid_input. - ENDIF. - - IF iv_show_type = '2D' OR iv_show_type = '3D' OR iv_show_type = 'IMAX'. - IF iv_show_type = '2D'. - lv_x = 9. - ELSEIF iv_show_type = '3D'. - lv_x = '12.50'. - ELSE. - lv_x = 16. - ENDIF. - ELSE. - RAISE invalid_input. - ENDIF. - - IF iv_cust_type = 'CHILD'. - lv_y = 40. - ELSEIF iv_cust_type = 'SENIOR'. - lv_y = 30. - ELSEIF iv_cust_type = 'STUDENT'. - lv_y = 20. - ELSEIF iv_cust_type = 'ADULT'. - lv_y = 0. - ELSE. - RAISE invalid_input. - ENDIF. - - IF iv_show_time < '170000'. - IF iv_cust_type <> 'CHILD'. - lv_y = lv_y + 25. - ENDIF. - ENDIF. - - IF iv_seats >= 8. - lv_y = lv_y + 10. - ENDIF. - - IF lv_y > 60. - lv_y = 60. - ENDIF. - - lv_x = lv_x - lv_x * lv_y / 100. - lv_x = lv_x + '0.5'. - - lv_z = 0. - DO iv_seats TIMES. - lv_z = lv_z + 1. - ENDDO. - - ev_total = round( val = lv_x * lv_z dec = 2 mode = cl_abap_math=>round_half_up ). - ev_discount = lv_y. - -ENDFUNCTION. diff --git a/tasks_gen/eval/G0144/seed/ski_rental_old.func.abap b/tasks_gen/eval/G0144/seed/ski_rental_old.func.abap new file mode 100644 index 0000000..9e1f875 --- /dev/null +++ b/tasks_gen/eval/G0144/seed/ski_rental_old.func.abap @@ -0,0 +1,78 @@ +FUNCTION {{p}}ski_rental_old + IMPORTING + iv_equipment TYPE string + iv_days TYPE i + iv_customer TYPE string + iv_insurance TYPE abap_bool + EXPORTING + ev_price TYPE decfloat34 + ev_deposit TYPE decfloat34 + EXCEPTIONS + invalid_equipment + invalid_days + invalid_customer. + + DATA lv_daily TYPE decfloat34. + DATA lv_discount TYPE decfloat34. + DATA lv_total TYPE decfloat34. + DATA lv_duration_disc TYPE decfloat34. + + IF iv_days < 1. + RAISE invalid_days. + ENDIF. + + IF iv_equipment = 'SKI'. + lv_daily = 25. + ELSEIF iv_equipment = 'SNOWBOARD'. + lv_daily = 30. + ELSEIF iv_equipment = 'BOOTS'. + lv_daily = 10. + ELSEIF iv_equipment = 'HELMET'. + lv_daily = 5. + ELSE. + RAISE invalid_equipment. + ENDIF. + + IF iv_customer = 'ADULT'. + lv_discount = 0. + ELSEIF iv_customer = 'CHILD'. + lv_discount = 50. + ELSEIF iv_customer = 'SENIOR'. + lv_discount = 20. + ELSE. + RAISE invalid_customer. + ENDIF. + + lv_total = lv_daily * iv_days. + lv_total = lv_total - lv_total * lv_discount / 100. + + IF iv_days >= 7. + lv_duration_disc = 10. + ELSEIF iv_days >= 3. + lv_duration_disc = 5. + ELSE. + lv_duration_disc = 0. + ENDIF. + lv_total = lv_total - lv_total * lv_duration_disc / 100. + + IF iv_insurance = abap_true. + lv_total = lv_total + 5 * iv_days. + ENDIF. + + ev_price = round( val = lv_total dec = 2 mode = cl_abap_math=>round_half_up ). + + IF iv_equipment = 'SKI'. + ev_deposit = 100. + ELSEIF iv_equipment = 'SNOWBOARD'. + ev_deposit = 120. + ELSEIF iv_equipment = 'BOOTS'. + ev_deposit = 20. + ELSEIF iv_equipment = 'HELMET'. + ev_deposit = 10. + ENDIF. + + IF iv_insurance = abap_true. + ev_deposit = ev_deposit + 50. + ENDIF. + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0144/spec.md b/tasks_gen/eval/G0144/spec.md index ec040ad..458da61 100644 --- a/tasks_gen/eval/G0144/spec.md +++ b/tasks_gen/eval/G0144/spec.md @@ -1,44 +1,32 @@ # 1. Goal -The function module {{P}}CINE_FEE_OLD in function group {{P}}FG_CINE calculates -the price of a cinema ticket order. The code is legacy code. Refactor the -function module in place. The behavior stays the same. The name and the public -interface stay the same. +Refactor the legacy function module {{P}}SKI_RENTAL_OLD in function group {{P}}FG_SKI. The function module calculates the rental price and the deposit for ski equipment. Improve the readability, the maintainability, and the structure of the code. The behavior must stay the same. The public interface must not change. # 2. Open questions None. # 3. Context -- Function group {{P}}FG_CINE exists in package $TMP. -- The function module {{P}}CINE_FEE_OLD exists in this function group. It holds - the legacy code. -- A ticket desk program calls {{P}}CINE_FEE_OLD for each ticket order. This call - must not change. +- Function group {{P}}FG_SKI exists in package $TMP. +- Function module {{P}}SKI_RENTAL_OLD exists in this group. It contains legacy code. +- A rental program calls the function module. The callers use the current interface. # 4. Contract -- Object: the function module {{P}}CINE_FEE_OLD in function group {{P}}FG_CINE. -- Keep the name and the interface of the function module: the same parameter - names, parameter kinds, parameter types and the same exception. -- Importing parameters: iv_show_type TYPE string, iv_seats TYPE i, - iv_show_time TYPE t, iv_cust_type TYPE string. -- Exporting parameters: ev_total TYPE decfloat34, ev_discount TYPE decfloat34. -- Exception: invalid_input. +- The function module {{P}}SKI_RENTAL_OLD keeps its name and its function group. +- The interface stays exactly the same: + - Importing: iv_equipment TYPE string, iv_days TYPE i, iv_customer TYPE string, iv_insurance TYPE abap_bool + - Exporting: ev_price TYPE decfloat34, ev_deposit TYPE decfloat34 + - Exceptions: invalid_equipment, invalid_days, invalid_customer # 5. Business rules -The legacy source code of {{P}}CINE_FEE_OLD is the only source of the business -rules. Read this source code. The one rule of this task: for every input the -function module returns the same output values and the same exception as before -the refactoring. Do not add, remove or change a rule. +The business rules are defined by the current implementation of {{P}}SKI_RENTAL_OLD. The behavior must stay the same. Read the legacy code to understand the rules. # 6. Constraints -- Release target: SAP_BASIS 816. -- Coding standards: Clean ABAP. No ATC priority 1 or priority 2 finding. Keep - every procedure and every method below 40 statements. Replace literal numbers - with named constants. Use meaningful names. -- Out of scope: do not change the interface. Do not change the function group - {{P}}FG_CINE. +- Release target: 8.16. +- The function module must be active and have no syntax error. +- Refactor the code in place. Do not change the public interface. +- Follow Clean ABAP: small methods, no duplication, meaningful names, constants for literals. +- Out of scope: do not change the function group {{P}}FG_SKI. Do not create new function modules. # 7. Acceptance -- {{P}}CINE_FEE_OLD is active and has no syntax error. -- The behavior is unchanged. +- The function module is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests for the function module in a global test class. diff --git a/tasks_gen/eval/G0144/task.json b/tasks_gen/eval/G0144/task.json index 52bb365..369a90a 100644 --- a/tasks_gen/eval/G0144/task.json +++ b/tasks_gen/eval/G0144/task.json @@ -12,75 +12,77 @@ "seed": [ { "type": "FUGR", - "name": "{{P}}FG_CINE", - "description": "Cinema ticket function group" + "name": "{{P}}FG_SKI", + "description": "Ski rental function group" }, { "type": "FUNC", - "name": "{{P}}CINE_FEE_OLD", - "functionGroup": "{{P}}FG_CINE", - "file": "seed/cine_fee_old.func.abap", - "description": "Legacy ticket price calculation" + "name": "{{P}}SKI_RENTAL_OLD", + "functionGroup": "{{P}}FG_SKI", + "file": "seed/ski_rental_old.func.abap", + "description": "Legacy ski rental pricing" } ], "contract": [ { "type": "FUNC", - "name": "{{P}}CINE_FEE_OLD", - "functionGroup": "{{P}}FG_CINE", + "name": "{{P}}SKI_RENTAL_OLD", + "functionGroup": "{{P}}FG_SKI", "params": [ { - "name": "iv_show_type", + "name": "iv_equipment", "type": "string" }, { - "name": "iv_seats", + "name": "iv_days", "type": "i" }, { - "name": "iv_show_time", - "type": "t" - }, - { - "name": "iv_cust_type", + "name": "iv_customer", "type": "string" }, { - "name": "ev_total", + "name": "iv_insurance", + "type": "abap_bool" + }, + { + "name": "ev_price", "type": "decfloat34" }, { - "name": "ev_discount", + "name": "ev_deposit", "type": "decfloat34" } + ], + "exceptions": [ + "invalid_equipment", + "invalid_days", + "invalid_customer" ] } ], - "out_of_scope": [ - "{{P}}FG_CINE" - ], + "out_of_scope": [], "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}CINE_HIDDEN", - "file": "hidden/cine_hidden.clas.abap", - "description": "Hidden behavior tests for the refactored ticket price calculation" + "name": "{{P}}T_SKI_HIDDEN", + "file": "hidden/t_ski_hidden.clas.abap", + "description": "Hidden tests for ski rental pricing" } ], "reference": [ { "type": "FUNC", - "name": "{{P}}CINE_FEE_OLD", - "functionGroup": "{{P}}FG_CINE", - "file": "reference/cine_fee_old.func.abap", - "description": "Refactored ticket price calculation, same interface and behavior", - "overwrite": true + "name": "{{P}}SKI_RENTAL_OLD", + "functionGroup": "{{P}}FG_SKI", + "file": "reference/ski_rental_old.func.abap", + "description": "Refactored ski rental pricing" }, { "type": "CLAS", - "name": "{{P}}CINE_TEST", - "file": "reference/cine_test.clas.abap", - "description": "Own tests for the ticket price calculation" + "name": "{{P}}T_SKI_TEST", + "file": "reference/t_ski_test.clas.abap", + "description": "Own tests for ski rental pricing" } ], "craft_checks": [ diff --git a/tasks_gen/eval/G0145/empirical.json b/tasks_gen/eval/G0145/empirical.json new file mode 100644 index 0000000..ceee8ee --- /dev/null +++ b/tasks_gen/eval/G0145/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 85.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 10.0, + "total": 85.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 45, + "seconds": 159.2, + "run_dir": "runs/emp/11015_G0145_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0145/review.json b/tasks_gen/eval/G0145/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0145/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0146/empirical.json b/tasks_gen/eval/G0146/empirical.json new file mode 100644 index 0000000..00ba17a --- /dev/null +++ b/tasks_gen/eval/G0146/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "12/12", + "tool_calls": 34, + "seconds": 151.2, + "run_dir": "runs/emp/11016_G0146_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0146/review.json b/tasks_gen/eval/G0146/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0146/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0147/empirical.json b/tasks_gen/eval/G0147/empirical.json new file mode 100644 index 0000000..80a8b05 --- /dev/null +++ b/tasks_gen/eval/G0147/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 80.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 5.0, + "total": 80.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "7/7", + "tool_calls": 60, + "seconds": 120.6, + "run_dir": "runs/emp/11017_G0147_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0147/review.json b/tasks_gen/eval/G0147/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0147/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0148/empirical.json b/tasks_gen/eval/G0148/empirical.json new file mode 100644 index 0000000..5bbb81c --- /dev/null +++ b/tasks_gen/eval/G0148/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "12/12", + "tool_calls": 11, + "seconds": 59.5, + "run_dir": "runs/emp/11018_G0148_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0148/review.json b/tasks_gen/eval/G0148/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0148/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0149/empirical.json b/tasks_gen/eval/G0149/empirical.json new file mode 100644 index 0000000..e393c4d --- /dev/null +++ b/tasks_gen/eval/G0149/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 9, + "seconds": 71.5, + "run_dir": "runs/emp/11019_G0149_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0149/review.json b/tasks_gen/eval/G0149/review.json new file mode 100644 index 0000000..ebc3eea --- /dev/null +++ b/tasks_gen/eval/G0149/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Survived mutant: round dec +1, equivalent (result field has fewer decimals).", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0150/empirical.json b/tasks_gen/eval/G0150/empirical.json new file mode 100644 index 0000000..9a63e1b --- /dev/null +++ b/tasks_gen/eval/G0150/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 98.5, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 13.5, + "own_tests": 15.0, + "discipline": 10.0, + "total": 98.5, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "12/12", + "tool_calls": 12, + "seconds": 106.9, + "run_dir": "runs/emp/11020_G0150_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0150/review.json b/tasks_gen/eval/G0150/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0150/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0151/empirical.json b/tasks_gen/eval/G0151/empirical.json new file mode 100644 index 0000000..4f618b0 --- /dev/null +++ b/tasks_gen/eval/G0151/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 97.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 12.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 97.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 15, + "seconds": 43.9, + "run_dir": "runs/emp/11021_G0151_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0151/review.json b/tasks_gen/eval/G0151/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0151/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0152/empirical.json b/tasks_gen/eval/G0152/empirical.json new file mode 100644 index 0000000..b553123 --- /dev/null +++ b/tasks_gen/eval/G0152/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 85.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 10.0, + "total": 85.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 10, + "seconds": 61.4, + "run_dir": "runs/emp/11022_G0152_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0152/review.json b/tasks_gen/eval/G0152/review.json new file mode 100644 index 0000000..3978bb0 --- /dev/null +++ b/tasks_gen/eval/G0152/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Survived = -> <> in language pair: one direction of the pair untested. Minor.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0153/empirical.json b/tasks_gen/eval/G0153/empirical.json new file mode 100644 index 0000000..d82326a --- /dev/null +++ b/tasks_gen/eval/G0153/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 85.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 10.0, + "total": 85.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "6/6", + "tool_calls": 38, + "seconds": 151.2, + "run_dir": "runs/emp/11023_G0153_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0153/review.json b/tasks_gen/eval/G0153/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0153/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0154/empirical.json b/tasks_gen/eval/G0154/empirical.json new file mode 100644 index 0000000..0e9d011 --- /dev/null +++ b/tasks_gen/eval/G0154/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 80.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 5.0, + "total": 80.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "6/6", + "tool_calls": 27, + "seconds": 713.7, + "run_dir": "runs/emp/11024_G0154_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0154/review.json b/tasks_gen/eval/G0154/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0154/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0155/empirical.json b/tasks_gen/eval/G0155/empirical.json new file mode 100644 index 0000000..b8dfd2c --- /dev/null +++ b/tasks_gen/eval/G0155/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 80.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 5.0, + "total": 80.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 40, + "seconds": 144.2, + "run_dir": "runs/emp/11025_G0155_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0155/review.json b/tasks_gen/eval/G0155/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0155/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0156/empirical.json b/tasks_gen/eval/G0156/empirical.json new file mode 100644 index 0000000..029bc0e --- /dev/null +++ b/tasks_gen/eval/G0156/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 85.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 10.0, + "total": 85.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 11, + "seconds": 56.1, + "run_dir": "runs/emp/11026_G0156_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0156/review.json b/tasks_gen/eval/G0156/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0156/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0157/empirical.json b/tasks_gen/eval/G0157/empirical.json new file mode 100644 index 0000000..4dd5444 --- /dev/null +++ b/tasks_gen/eval/G0157/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 10, + "seconds": 45.7, + "run_dir": "runs/emp/11027_G0157_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0157/review.json b/tasks_gen/eval/G0157/review.json new file mode 100644 index 0000000..ebc3eea --- /dev/null +++ b/tasks_gen/eval/G0157/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Survived mutant: round dec +1, equivalent (result field has fewer decimals).", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0158/empirical.json b/tasks_gen/eval/G0158/empirical.json new file mode 100644 index 0000000..73e4db9 --- /dev/null +++ b/tasks_gen/eval/G0158/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 85.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 10.0, + "total": 85.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 11, + "seconds": 52.5, + "run_dir": "runs/emp/11028_G0158_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0158/review.json b/tasks_gen/eval/G0158/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0158/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0159/empirical.json b/tasks_gen/eval/G0159/empirical.json new file mode 100644 index 0000000..83dd8cb --- /dev/null +++ b/tasks_gen/eval/G0159/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 85.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 10.0, + "total": 85.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 11, + "seconds": 36.2, + "run_dir": "runs/emp/11029_G0159_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0159/review.json b/tasks_gen/eval/G0159/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0159/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0160/faulty/m0_print_sum.prog.abap b/tasks_gen/eval/G0160/faulty/m0_print_sum.prog.abap new file mode 100644 index 0000000..536f83d --- /dev/null +++ b/tasks_gen/eval/G0160/faulty/m0_print_sum.prog.abap @@ -0,0 +1,147 @@ +REPORT {{p}}print_sum. + +DATA gv_customer TYPE {{p}}prtjob-customer. + +PARAMETERS p_from TYPE d OBLIGATORY. +SELECT-OPTIONS s_cust FOR gv_customer. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_job, + customer TYPE {{p}}prtjob-customer, + sheets TYPE {{p}}prtjob-sheets, + amount TYPE {{p}}prtjob-amount, + END OF ty_job, + tt_job TYPE STANDARD TABLE OF ty_job, + BEGIN OF ty_line, + customer TYPE {{p}}prtjob-customer, + jobs TYPE i, + sheets TYPE {{p}}prtjob-sheets, + revenue TYPE {{p}}prtjob-amount, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line, + tt_customer TYPE RANGE OF {{p}}prtjob-customer. + METHODS read_jobs + IMPORTING iv_from TYPE d + it_customer TYPE tt_customer + CHANGING ct_jobs TYPE tt_job. + METHODS aggregate + IMPORTING it_jobs TYPE tt_job + CHANGING ct_lines TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD read_jobs. + SELECT customer sheets amount + INTO CORRESPONDING FIELDS OF TABLE ct_jobs + FROM {{p}}prtjob + WHERE job_date < iv_from + AND customer IN it_customer. + ENDMETHOD. + + METHOD aggregate. + FIELD-SYMBOLS TYPE ty_job. + FIELD-SYMBOLS TYPE ty_line. + + LOOP AT it_jobs ASSIGNING . + READ TABLE ct_lines ASSIGNING + WITH KEY customer = -customer. + IF sy-subrc <> 0. + APPEND INITIAL LINE TO ct_lines ASSIGNING . + -customer = -customer. + ENDIF. + -jobs = -jobs + 1. + -sheets = -sheets + -sheets. + -revenue = -revenue + -amount. + ENDLOOP. + + SORT ct_lines BY revenue DESCENDING customer ASCENDING. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + TRY. + cl_salv_table=>factory( + IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA lt_customer TYPE lcl_report=>tt_customer. + + CREATE OBJECT go_report. + lt_customer = s_cust[]. + go_report->read_jobs( + EXPORTING iv_from = p_from it_customer = lt_customer + CHANGING ct_jobs = lt_jobs ). + go_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + go_report->display( CHANGING ct_lines = lt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS aggregate_jobs FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD aggregate_jobs. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA ls_job TYPE lcl_report=>ty_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + DATA lo_report TYPE REF TO lcl_report. + DATA lv_count TYPE i. + DATA lv_amount TYPE {{p}}prtjob-amount. + DATA lv_customer TYPE {{p}}prtjob-customer. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 10. + ls_job-amount = 10. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 5. + ls_job-amount = 5. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'B'. + ls_job-sheets = 20. + ls_job-amount = 40. + APPEND ls_job TO lt_jobs. + + CREATE OBJECT lo_report. + lo_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + + DESCRIBE TABLE lt_lines LINES lv_count. + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ). + + READ TABLE lt_lines INTO ls_line INDEX 1. + lv_customer = 'B'. + cl_abap_unit_assert=>assert_equals( exp = lv_customer act = ls_line-customer ). + lv_amount = 40. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + + READ TABLE lt_lines INTO ls_line INDEX 2. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-jobs ). + lv_amount = 15. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0160/faulty/m1_print_sum.prog.abap b/tasks_gen/eval/G0160/faulty/m1_print_sum.prog.abap new file mode 100644 index 0000000..c2fe537 --- /dev/null +++ b/tasks_gen/eval/G0160/faulty/m1_print_sum.prog.abap @@ -0,0 +1,147 @@ +REPORT {{p}}print_sum. + +DATA gv_customer TYPE {{p}}prtjob-customer. + +PARAMETERS p_from TYPE d OBLIGATORY. +SELECT-OPTIONS s_cust FOR gv_customer. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_job, + customer TYPE {{p}}prtjob-customer, + sheets TYPE {{p}}prtjob-sheets, + amount TYPE {{p}}prtjob-amount, + END OF ty_job, + tt_job TYPE STANDARD TABLE OF ty_job, + BEGIN OF ty_line, + customer TYPE {{p}}prtjob-customer, + jobs TYPE i, + sheets TYPE {{p}}prtjob-sheets, + revenue TYPE {{p}}prtjob-amount, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line, + tt_customer TYPE RANGE OF {{p}}prtjob-customer. + METHODS read_jobs + IMPORTING iv_from TYPE d + it_customer TYPE tt_customer + CHANGING ct_jobs TYPE tt_job. + METHODS aggregate + IMPORTING it_jobs TYPE tt_job + CHANGING ct_lines TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD read_jobs. + SELECT customer sheets amount + INTO CORRESPONDING FIELDS OF TABLE ct_jobs + FROM {{p}}prtjob + WHERE job_date >= iv_from + OR customer IN it_customer. + ENDMETHOD. + + METHOD aggregate. + FIELD-SYMBOLS TYPE ty_job. + FIELD-SYMBOLS TYPE ty_line. + + LOOP AT it_jobs ASSIGNING . + READ TABLE ct_lines ASSIGNING + WITH KEY customer = -customer. + IF sy-subrc <> 0. + APPEND INITIAL LINE TO ct_lines ASSIGNING . + -customer = -customer. + ENDIF. + -jobs = -jobs + 1. + -sheets = -sheets + -sheets. + -revenue = -revenue + -amount. + ENDLOOP. + + SORT ct_lines BY revenue DESCENDING customer ASCENDING. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + TRY. + cl_salv_table=>factory( + IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA lt_customer TYPE lcl_report=>tt_customer. + + CREATE OBJECT go_report. + lt_customer = s_cust[]. + go_report->read_jobs( + EXPORTING iv_from = p_from it_customer = lt_customer + CHANGING ct_jobs = lt_jobs ). + go_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + go_report->display( CHANGING ct_lines = lt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS aggregate_jobs FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD aggregate_jobs. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA ls_job TYPE lcl_report=>ty_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + DATA lo_report TYPE REF TO lcl_report. + DATA lv_count TYPE i. + DATA lv_amount TYPE {{p}}prtjob-amount. + DATA lv_customer TYPE {{p}}prtjob-customer. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 10. + ls_job-amount = 10. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 5. + ls_job-amount = 5. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'B'. + ls_job-sheets = 20. + ls_job-amount = 40. + APPEND ls_job TO lt_jobs. + + CREATE OBJECT lo_report. + lo_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + + DESCRIBE TABLE lt_lines LINES lv_count. + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ). + + READ TABLE lt_lines INTO ls_line INDEX 1. + lv_customer = 'B'. + cl_abap_unit_assert=>assert_equals( exp = lv_customer act = ls_line-customer ). + lv_amount = 40. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + + READ TABLE lt_lines INTO ls_line INDEX 2. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-jobs ). + lv_amount = 15. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0160/faulty/m2_print_sum.prog.abap b/tasks_gen/eval/G0160/faulty/m2_print_sum.prog.abap new file mode 100644 index 0000000..51fb9fc --- /dev/null +++ b/tasks_gen/eval/G0160/faulty/m2_print_sum.prog.abap @@ -0,0 +1,147 @@ +REPORT {{p}}print_sum. + +DATA gv_customer TYPE {{p}}prtjob-customer. + +PARAMETERS p_from TYPE d OBLIGATORY. +SELECT-OPTIONS s_cust FOR gv_customer. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_job, + customer TYPE {{p}}prtjob-customer, + sheets TYPE {{p}}prtjob-sheets, + amount TYPE {{p}}prtjob-amount, + END OF ty_job, + tt_job TYPE STANDARD TABLE OF ty_job, + BEGIN OF ty_line, + customer TYPE {{p}}prtjob-customer, + jobs TYPE i, + sheets TYPE {{p}}prtjob-sheets, + revenue TYPE {{p}}prtjob-amount, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line, + tt_customer TYPE RANGE OF {{p}}prtjob-customer. + METHODS read_jobs + IMPORTING iv_from TYPE d + it_customer TYPE tt_customer + CHANGING ct_jobs TYPE tt_job. + METHODS aggregate + IMPORTING it_jobs TYPE tt_job + CHANGING ct_lines TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD read_jobs. + SELECT customer sheets amount + INTO CORRESPONDING FIELDS OF TABLE ct_jobs + FROM {{p}}prtjob + WHERE job_date >= iv_from + AND customer IN it_customer. + ENDMETHOD. + + METHOD aggregate. + FIELD-SYMBOLS TYPE ty_job. + FIELD-SYMBOLS TYPE ty_line. + + LOOP AT it_jobs ASSIGNING . + READ TABLE ct_lines ASSIGNING + WITH KEY customer = -customer. + IF sy-subrc <> 0. + APPEND INITIAL LINE TO ct_lines ASSIGNING . + -customer = -customer. + ENDIF. + -jobs = -jobs - 1. + -sheets = -sheets + -sheets. + -revenue = -revenue + -amount. + ENDLOOP. + + SORT ct_lines BY revenue DESCENDING customer ASCENDING. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + TRY. + cl_salv_table=>factory( + IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA lt_customer TYPE lcl_report=>tt_customer. + + CREATE OBJECT go_report. + lt_customer = s_cust[]. + go_report->read_jobs( + EXPORTING iv_from = p_from it_customer = lt_customer + CHANGING ct_jobs = lt_jobs ). + go_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + go_report->display( CHANGING ct_lines = lt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS aggregate_jobs FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD aggregate_jobs. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA ls_job TYPE lcl_report=>ty_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + DATA lo_report TYPE REF TO lcl_report. + DATA lv_count TYPE i. + DATA lv_amount TYPE {{p}}prtjob-amount. + DATA lv_customer TYPE {{p}}prtjob-customer. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 10. + ls_job-amount = 10. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 5. + ls_job-amount = 5. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'B'. + ls_job-sheets = 20. + ls_job-amount = 40. + APPEND ls_job TO lt_jobs. + + CREATE OBJECT lo_report. + lo_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + + DESCRIBE TABLE lt_lines LINES lv_count. + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ). + + READ TABLE lt_lines INTO ls_line INDEX 1. + lv_customer = 'B'. + cl_abap_unit_assert=>assert_equals( exp = lv_customer act = ls_line-customer ). + lv_amount = 40. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + + READ TABLE lt_lines INTO ls_line INDEX 2. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-jobs ). + lv_amount = 15. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0160/faulty/m3_print_sum.prog.abap b/tasks_gen/eval/G0160/faulty/m3_print_sum.prog.abap new file mode 100644 index 0000000..2213081 --- /dev/null +++ b/tasks_gen/eval/G0160/faulty/m3_print_sum.prog.abap @@ -0,0 +1,147 @@ +REPORT {{p}}print_sum. + +DATA gv_customer TYPE {{p}}prtjob-customer. + +PARAMETERS p_from TYPE d OBLIGATORY. +SELECT-OPTIONS s_cust FOR gv_customer. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_job, + customer TYPE {{p}}prtjob-customer, + sheets TYPE {{p}}prtjob-sheets, + amount TYPE {{p}}prtjob-amount, + END OF ty_job, + tt_job TYPE STANDARD TABLE OF ty_job, + BEGIN OF ty_line, + customer TYPE {{p}}prtjob-customer, + jobs TYPE i, + sheets TYPE {{p}}prtjob-sheets, + revenue TYPE {{p}}prtjob-amount, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line, + tt_customer TYPE RANGE OF {{p}}prtjob-customer. + METHODS read_jobs + IMPORTING iv_from TYPE d + it_customer TYPE tt_customer + CHANGING ct_jobs TYPE tt_job. + METHODS aggregate + IMPORTING it_jobs TYPE tt_job + CHANGING ct_lines TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD read_jobs. + SELECT customer sheets amount + INTO CORRESPONDING FIELDS OF TABLE ct_jobs + FROM {{p}}prtjob + WHERE job_date >= iv_from + AND customer IN it_customer. + ENDMETHOD. + + METHOD aggregate. + FIELD-SYMBOLS TYPE ty_job. + FIELD-SYMBOLS TYPE ty_line. + + LOOP AT it_jobs ASSIGNING . + READ TABLE ct_lines ASSIGNING + WITH KEY customer = -customer. + IF sy-subrc <> 0. + APPEND INITIAL LINE TO ct_lines ASSIGNING . + -customer = -customer. + ENDIF. + -jobs = -jobs + 1. + -sheets = -sheets - -sheets. + -revenue = -revenue + -amount. + ENDLOOP. + + SORT ct_lines BY revenue DESCENDING customer ASCENDING. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + TRY. + cl_salv_table=>factory( + IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA lt_customer TYPE lcl_report=>tt_customer. + + CREATE OBJECT go_report. + lt_customer = s_cust[]. + go_report->read_jobs( + EXPORTING iv_from = p_from it_customer = lt_customer + CHANGING ct_jobs = lt_jobs ). + go_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + go_report->display( CHANGING ct_lines = lt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS aggregate_jobs FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD aggregate_jobs. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA ls_job TYPE lcl_report=>ty_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + DATA lo_report TYPE REF TO lcl_report. + DATA lv_count TYPE i. + DATA lv_amount TYPE {{p}}prtjob-amount. + DATA lv_customer TYPE {{p}}prtjob-customer. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 10. + ls_job-amount = 10. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 5. + ls_job-amount = 5. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'B'. + ls_job-sheets = 20. + ls_job-amount = 40. + APPEND ls_job TO lt_jobs. + + CREATE OBJECT lo_report. + lo_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + + DESCRIBE TABLE lt_lines LINES lv_count. + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ). + + READ TABLE lt_lines INTO ls_line INDEX 1. + lv_customer = 'B'. + cl_abap_unit_assert=>assert_equals( exp = lv_customer act = ls_line-customer ). + lv_amount = 40. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + + READ TABLE lt_lines INTO ls_line INDEX 2. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-jobs ). + lv_amount = 15. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0160/faulty/m4_print_sum.prog.abap b/tasks_gen/eval/G0160/faulty/m4_print_sum.prog.abap new file mode 100644 index 0000000..d25721f --- /dev/null +++ b/tasks_gen/eval/G0160/faulty/m4_print_sum.prog.abap @@ -0,0 +1,147 @@ +REPORT {{p}}print_sum. + +DATA gv_customer TYPE {{p}}prtjob-customer. + +PARAMETERS p_from TYPE d OBLIGATORY. +SELECT-OPTIONS s_cust FOR gv_customer. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_job, + customer TYPE {{p}}prtjob-customer, + sheets TYPE {{p}}prtjob-sheets, + amount TYPE {{p}}prtjob-amount, + END OF ty_job, + tt_job TYPE STANDARD TABLE OF ty_job, + BEGIN OF ty_line, + customer TYPE {{p}}prtjob-customer, + jobs TYPE i, + sheets TYPE {{p}}prtjob-sheets, + revenue TYPE {{p}}prtjob-amount, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line, + tt_customer TYPE RANGE OF {{p}}prtjob-customer. + METHODS read_jobs + IMPORTING iv_from TYPE d + it_customer TYPE tt_customer + CHANGING ct_jobs TYPE tt_job. + METHODS aggregate + IMPORTING it_jobs TYPE tt_job + CHANGING ct_lines TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD read_jobs. + SELECT customer sheets amount + INTO CORRESPONDING FIELDS OF TABLE ct_jobs + FROM {{p}}prtjob + WHERE job_date >= iv_from + AND customer IN it_customer. + ENDMETHOD. + + METHOD aggregate. + FIELD-SYMBOLS TYPE ty_job. + FIELD-SYMBOLS TYPE ty_line. + + LOOP AT it_jobs ASSIGNING . + READ TABLE ct_lines ASSIGNING + WITH KEY customer = -customer. + IF sy-subrc <> 0. + APPEND INITIAL LINE TO ct_lines ASSIGNING . + -customer = -customer. + ENDIF. + -jobs = -jobs + 1. + -sheets = -sheets + -sheets. + -revenue = -revenue - -amount. + ENDLOOP. + + SORT ct_lines BY revenue DESCENDING customer ASCENDING. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + TRY. + cl_salv_table=>factory( + IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA lt_customer TYPE lcl_report=>tt_customer. + + CREATE OBJECT go_report. + lt_customer = s_cust[]. + go_report->read_jobs( + EXPORTING iv_from = p_from it_customer = lt_customer + CHANGING ct_jobs = lt_jobs ). + go_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + go_report->display( CHANGING ct_lines = lt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS aggregate_jobs FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD aggregate_jobs. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA ls_job TYPE lcl_report=>ty_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + DATA lo_report TYPE REF TO lcl_report. + DATA lv_count TYPE i. + DATA lv_amount TYPE {{p}}prtjob-amount. + DATA lv_customer TYPE {{p}}prtjob-customer. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 10. + ls_job-amount = 10. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 5. + ls_job-amount = 5. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'B'. + ls_job-sheets = 20. + ls_job-amount = 40. + APPEND ls_job TO lt_jobs. + + CREATE OBJECT lo_report. + lo_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + + DESCRIBE TABLE lt_lines LINES lv_count. + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ). + + READ TABLE lt_lines INTO ls_line INDEX 1. + lv_customer = 'B'. + cl_abap_unit_assert=>assert_equals( exp = lv_customer act = ls_line-customer ). + lv_amount = 40. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + + READ TABLE lt_lines INTO ls_line INDEX 2. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-jobs ). + lv_amount = 15. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0160/generation.json b/tasks_gen/eval/G0160/generation.json new file mode 100644 index 0000000..b26f019 --- /dev/null +++ b/tasks_gen/eval/G0160/generation.json @@ -0,0 +1,50 @@ +{ + "id": "G0160", + "pool": "eval", + "object_type": "PROG", + "category": "G", + "attempts": [ + { + "stage": "bundle", + "errors": [ + "seed/t31_seed.clas.abap line 9: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"INSERT\"", + "hidden/t31_hidden.clas.abap line 48: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"ASSIGN\"", + "hidden/t31_hidden.clas.abap line 49: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"ASSIGN\"", + "hidden/t31_hidden.clas.abap line 51: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"rv_value\"", + "hidden/t31_hidden.clas.abap line 72: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"DATA\"", + "reference/print_sum.prog.abap line 55: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"go_report\"", + "reference/print_sum.prog.abap line 70: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"go_env\"", + "reference/print_sum.prog.abap line 73: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"lt_job\"", + "reference/print_sum.prog.abap line 87: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"go_report\"", + "reference/print_sum.prog.abap line 92: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"", + "reference/print_sum.prog.abap line 95: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"", + "reference/print_sum.prog.abap line 100: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"lt_customer\"", + "reference/print_sum.prog.abap line 102: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"go_report\"" + ], + "by_check": { + "abaplint": 13 + } + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 89.5, + "null": 0 + }, + { + "stage": "validate", + "oracle": 100.0, + "null": 0, + "mutation": { + "valid": 5, + "killed": 5, + "ok": true + } + } + ], + "accepted": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0160/hidden/t31_hidden.clas.abap b/tasks_gen/eval/G0160/hidden/t31_hidden.clas.abap new file mode 100644 index 0000000..6dc6cd6 --- /dev/null +++ b/tasks_gen/eval/G0160/hidden/t31_hidden.clas.abap @@ -0,0 +1,141 @@ +CLASS {{p}}t31_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + TYPES tt_customer TYPE RANGE OF {{p}}prtjob-customer. + + METHODS run + IMPORTING iv_from TYPE d + it_customer TYPE tt_customer OPTIONAL + RETURNING VALUE(rr_data) TYPE REF TO data. + + METHODS value_of + IMPORTING ir_data TYPE REF TO data + iv_row TYPE i + iv_col TYPE string + RETURNING VALUE(rv_value) TYPE string. + + METHODS lines_of + IMPORTING ir_data TYPE REF TO data + RETURNING VALUE(rv_lines) TYPE i. + + METHODS all_customers FOR TESTING. + METHODS sorted_by_revenue FOR TESTING. + METHODS totals_and_counts FOR TESTING. + METHODS customer_filter FOR TESTING. + METHODS date_filter FOR TESTING. + METHODS tie_break_by_customer FOR TESTING. +ENDCLASS. + + +CLASS {{p}}t31_hidden IMPLEMENTATION. + METHOD run. + cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ). + SUBMIT {{p}}print_sum WITH p_from = iv_from WITH s_cust IN it_customer AND RETURN. + TRY. + cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ). + CATCH cx_salv_bs_sc_runtime_info. + ENDTRY. + cl_salv_bs_runtime_info=>clear_all( ). + ENDMETHOD. + + METHOD lines_of. + FIELD-SYMBOLS TYPE STANDARD TABLE. + IF ir_data IS BOUND. + ASSIGN ir_data->* TO . + rv_lines = lines( ). + ENDIF. + ENDMETHOD. + + METHOD value_of. + FIELD-SYMBOLS TYPE STANDARD TABLE. + FIELD-SYMBOLS TYPE any. + FIELD-SYMBOLS TYPE any. + DATA lv_text TYPE string. + + ASSIGN ir_data->* TO . + READ TABLE ASSIGNING INDEX iv_row. + cl_abap_unit_assert=>assert_subrc( exp = 0 msg = 'Row is missing' ). + ASSIGN COMPONENT iv_col OF STRUCTURE TO . + cl_abap_unit_assert=>assert_subrc( exp = 0 msg = 'Column is missing' ). + lv_text = . + CONDENSE lv_text. + rv_value = lv_text. + ENDMETHOD. + + METHOD all_customers. + DATA lr_data TYPE REF TO data. + DATA lv_lines TYPE i. + + lr_data = run( '20250101' ). + lv_lines = lines_of( lr_data ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_lines ). + ENDMETHOD. + + METHOD sorted_by_revenue. + DATA lr_data TYPE REF TO data. + DATA lv_value TYPE string. + + lr_data = run( '20250101' ). + lv_value = value_of( ir_data = lr_data iv_row = 1 iv_col = 'CUSTOMER' ). + cl_abap_unit_assert=>assert_equals( exp = 'GAMMA' act = lv_value ). + lv_value = value_of( ir_data = lr_data iv_row = 2 iv_col = 'CUSTOMER' ). + cl_abap_unit_assert=>assert_equals( exp = 'ALPHA' act = lv_value ). + lv_value = value_of( ir_data = lr_data iv_row = 1 iv_col = 'REVENUE' ). + cl_abap_unit_assert=>assert_equals( exp = '520.00' act = lv_value ). + ENDMETHOD. + + METHOD totals_and_counts. + DATA lr_data TYPE REF TO data. + DATA lv_value TYPE string. + + lr_data = run( '20250101' ). + lv_value = value_of( ir_data = lr_data iv_row = 1 iv_col = 'JOBS' ). + cl_abap_unit_assert=>assert_equals( exp = '2' act = lv_value ). + lv_value = value_of( ir_data = lr_data iv_row = 1 iv_col = 'SHEETS' ). + cl_abap_unit_assert=>assert_equals( exp = '410' act = lv_value ). + ENDMETHOD. + + METHOD customer_filter. + DATA lr_data TYPE REF TO data. + DATA lt_customer TYPE tt_customer. + DATA ls_customer TYPE LINE OF tt_customer. + DATA lv_lines TYPE i. + DATA lv_value TYPE string. + + ls_customer-sign = 'I'. + ls_customer-option = 'EQ'. + ls_customer-low = 'ALPHA'. + APPEND ls_customer TO lt_customer. + + lr_data = run( iv_from = '20250101' it_customer = lt_customer ). + lv_lines = lines_of( lr_data ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_lines ). + lv_value = value_of( ir_data = lr_data iv_row = 1 iv_col = 'REVENUE' ). + cl_abap_unit_assert=>assert_equals( exp = '350.00' act = lv_value ). + ENDMETHOD. + + METHOD date_filter. + DATA lr_data TYPE REF TO data. + DATA lv_lines TYPE i. + DATA lv_value TYPE string. + + lr_data = run( '20260201' ). + lv_lines = lines_of( lr_data ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_lines ). + lv_value = value_of( ir_data = lr_data iv_row = 1 iv_col = 'CUSTOMER' ). + cl_abap_unit_assert=>assert_equals( exp = 'ALPHA' act = lv_value ). + lv_value = value_of( ir_data = lr_data iv_row = 1 iv_col = 'REVENUE' ). + cl_abap_unit_assert=>assert_equals( exp = '100.00' act = lv_value ). + ENDMETHOD. + + METHOD tie_break_by_customer. + DATA lr_data TYPE REF TO data. + DATA lv_value TYPE string. + + lr_data = run( '20250101' ). + lv_value = value_of( ir_data = lr_data iv_row = 2 iv_col = 'CUSTOMER' ). + cl_abap_unit_assert=>assert_equals( exp = 'ALPHA' act = lv_value ). + lv_value = value_of( ir_data = lr_data iv_row = 3 iv_col = 'CUSTOMER' ). + cl_abap_unit_assert=>assert_equals( exp = 'BETA' act = lv_value ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0160/hidden/vine_hidden.clas.abap b/tasks_gen/eval/G0160/hidden/vine_hidden.clas.abap deleted file mode 100644 index e97db27..0000000 --- a/tasks_gen/eval/G0160/hidden/vine_hidden.clas.abap +++ /dev/null @@ -1,120 +0,0 @@ -CLASS {{p}}vine_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - TYPES tt_variety TYPE RANGE OF {{p}}grape-variety. - METHODS run - IMPORTING iv_from TYPE d - it_variety TYPE tt_variety OPTIONAL - RETURNING VALUE(rr_data) TYPE REF TO data. - METHODS value_of - IMPORTING ir_data TYPE REF TO data - iv_row TYPE i - iv_col TYPE string - RETURNING VALUE(rv_value) TYPE string. - METHODS lines_of - IMPORTING ir_data TYPE REF TO data - RETURNING VALUE(rv_lines) TYPE i. - METHODS add_variety - IMPORTING iv_variety TYPE {{p}}grape-variety - CHANGING ct_variety TYPE tt_variety. - METHODS all_varieties FOR TESTING. - METHODS sorted_by_total FOR TESTING. - METHODS totals_and_counts FOR TESTING. - METHODS variety_filter FOR TESTING. - METHODS date_filter FOR TESTING. - METHODS unknown_variety FOR TESTING. -ENDCLASS. - - -CLASS {{p}}vine_hidden IMPLEMENTATION. - METHOD run. - cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ). - SUBMIT {{p}}vineyard_rpt WITH p_from = iv_from WITH s_var IN it_variety AND RETURN. - TRY. - cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ). - CATCH cx_salv_bs_sc_runtime_info. - ENDTRY. - cl_salv_bs_runtime_info=>clear_all( ). - ENDMETHOD. - - METHOD lines_of. - FIELD-SYMBOLS TYPE STANDARD TABLE. - IF ir_data IS BOUND. - ASSIGN ir_data->* TO . - rv_lines = lines( ). - ENDIF. - ENDMETHOD. - - METHOD value_of. - FIELD-SYMBOLS TYPE STANDARD TABLE. - FIELD-SYMBOLS TYPE any. - FIELD-SYMBOLS TYPE any. - DATA lv_text TYPE string. - IF ir_data IS BOUND. - ASSIGN ir_data->* TO . - READ TABLE ASSIGNING INDEX iv_row. - cl_abap_unit_assert=>assert_subrc( exp = 0 msg = 'Row not found' ). - ASSIGN COMPONENT iv_col OF STRUCTURE TO . - cl_abap_unit_assert=>assert_subrc( exp = 0 msg = 'Column not found' ). - lv_text = . - CONDENSE lv_text. - rv_value = lv_text. - ENDIF. - ENDMETHOD. - - METHOD add_variety. - DATA ls_variety TYPE LINE OF tt_variety. - CLEAR ls_variety. - ls_variety-sign = 'I'. - ls_variety-option = 'EQ'. - ls_variety-low = iv_variety. - APPEND ls_variety TO ct_variety. - ENDMETHOD. - - METHOD all_varieties. - cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( run( '20260101' ) ) ). - ENDMETHOD. - - METHOD sorted_by_total. - DATA lr_data TYPE REF TO data. - lr_data = run( '20260101' ). - cl_abap_unit_assert=>assert_equals( exp = 'CHRD' act = value_of( ir_data = lr_data iv_row = 1 iv_col = 'VARIETY' ) ). - cl_abap_unit_assert=>assert_equals( exp = 'RIES' act = value_of( ir_data = lr_data iv_row = 3 iv_col = 'VARIETY' ) ). - ENDMETHOD. - - METHOD totals_and_counts. - DATA lr_data TYPE REF TO data. - lr_data = run( '20260101' ). - cl_abap_unit_assert=>assert_equals( exp = '2300.000' act = value_of( ir_data = lr_data iv_row = 1 iv_col = 'TOTAL_KG' ) ). - cl_abap_unit_assert=>assert_equals( exp = '2' act = value_of( ir_data = lr_data iv_row = 1 iv_col = 'HARVESTS' ) ). - cl_abap_unit_assert=>assert_equals( exp = 'Merlot' act = value_of( ir_data = lr_data iv_row = 2 iv_col = 'NAME' ) ). - ENDMETHOD. - - METHOD variety_filter. - DATA lr_data TYPE REF TO data. - DATA lt_variety TYPE tt_variety. - add_variety( EXPORTING iv_variety = 'CHRD' CHANGING ct_variety = lt_variety ). - lr_data = run( iv_from = '20260101' it_variety = lt_variety ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ). - cl_abap_unit_assert=>assert_equals( exp = '2300.000' act = value_of( ir_data = lr_data iv_row = 1 iv_col = 'TOTAL_KG' ) ). - ENDMETHOD. - - METHOD date_filter. - DATA lr_data TYPE REF TO data. - lr_data = run( '20260901' ). - cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ). - cl_abap_unit_assert=>assert_equals( exp = 'CHRD' act = value_of( ir_data = lr_data iv_row = 1 iv_col = 'VARIETY' ) ). - cl_abap_unit_assert=>assert_equals( exp = '2300.000' act = value_of( ir_data = lr_data iv_row = 1 iv_col = 'TOTAL_KG' ) ). - cl_abap_unit_assert=>assert_equals( exp = 'MERL' act = value_of( ir_data = lr_data iv_row = 2 iv_col = 'VARIETY' ) ). - cl_abap_unit_assert=>assert_equals( exp = '2000.500' act = value_of( ir_data = lr_data iv_row = 2 iv_col = 'TOTAL_KG' ) ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lines_of( run( '20261101' ) ) ). - ENDMETHOD. - - METHOD unknown_variety. - DATA lr_data TYPE REF TO data. - DATA lt_variety TYPE tt_variety. - add_variety( EXPORTING iv_variety = 'SYRA' CHANGING ct_variety = lt_variety ). - lr_data = run( iv_from = '20260101' it_variety = lt_variety ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lines_of( lr_data ) ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0160/mutation.json b/tasks_gen/eval/G0160/mutation.json index f056cb7..c8b3f9d 100644 --- a/tasks_gen/eval/G0160/mutation.json +++ b/tasks_gen/eval/G0160/mutation.json @@ -1,40 +1,64 @@ { - "task": "T42", + "task": "G0160", "mutants": [ { - "object": "{{P}}VINEYARD_RPT", - "mutant": "line 56: >= -> > (rel)", + "object": "{{P}}PRINT_SUM", + "mutant": "line 41: >= -> < (rel)", + "status": "killed", + "hidden": "0/6", + "failed_tests": [ + "ALL_CUSTOMERS", + "CUSTOMER_FILTER", + "DATE_FILTER", + "SORTED_BY_REVENUE", + "TIE_BREAK_BY_CUSTOMER", + "TOTALS_AND_COUNTS" + ] + }, + { + "object": "{{P}}PRINT_SUM", + "mutant": "line 42: AND -> OR (logic)", + "status": "killed", + "hidden": "4/6", + "failed_tests": [ + "CUSTOMER_FILTER", + "DATE_FILTER" + ] + }, + { + "object": "{{P}}PRINT_SUM", + "mutant": "line 56: + -> - (arith)", "status": "killed", "hidden": "5/6", "failed_tests": [ - "DATE_FILTER" + "TOTALS_AND_COUNTS" ] }, { - "object": "{{P}}VINEYARD_RPT", - "mutant": "line 76: IF sy-subrc = 0 -> IF sy-subrc <> 0 (logic)", + "object": "{{P}}PRINT_SUM", + "mutant": "line 57: + -> - (arith)", "status": "killed", - "hidden": "3/6", + "hidden": "5/6", "failed_tests": [ - "ALL_VARIETIES", + "TOTALS_AND_COUNTS" + ] + }, + { + "object": "{{P}}PRINT_SUM", + "mutant": "line 58: + -> - (arith)", + "status": "killed", + "hidden": "1/6", + "failed_tests": [ + "CUSTOMER_FILTER", "DATE_FILTER", - "UNKNOWN_VARIETY" - ] - }, - { - "object": "{{P}}VINEYARD_RPT", - "mutant": "line 85: DESCENDING -> ASCENDING (sort)", - "status": "killed", - "hidden": "3/6", - "failed_tests": [ - "SORTED_BY_TOTAL", - "TOTALS_AND_COUNTS", - "DATE_FILTER" + "SORTED_BY_REVENUE", + "TIE_BREAK_BY_CUSTOMER", + "TOTALS_AND_COUNTS" ] } ], - "valid": 3, - "killed": 3, + "valid": 5, + "killed": 5, "kill_rate": 1.0, "ok": true } \ No newline at end of file diff --git a/tasks_gen/eval/G0160/reference/print_sum.prog.abap b/tasks_gen/eval/G0160/reference/print_sum.prog.abap new file mode 100644 index 0000000..5c3b7b9 --- /dev/null +++ b/tasks_gen/eval/G0160/reference/print_sum.prog.abap @@ -0,0 +1,147 @@ +REPORT {{p}}print_sum. + +DATA gv_customer TYPE {{p}}prtjob-customer. + +PARAMETERS p_from TYPE d OBLIGATORY. +SELECT-OPTIONS s_cust FOR gv_customer. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_job, + customer TYPE {{p}}prtjob-customer, + sheets TYPE {{p}}prtjob-sheets, + amount TYPE {{p}}prtjob-amount, + END OF ty_job, + tt_job TYPE STANDARD TABLE OF ty_job, + BEGIN OF ty_line, + customer TYPE {{p}}prtjob-customer, + jobs TYPE i, + sheets TYPE {{p}}prtjob-sheets, + revenue TYPE {{p}}prtjob-amount, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line, + tt_customer TYPE RANGE OF {{p}}prtjob-customer. + METHODS read_jobs + IMPORTING iv_from TYPE d + it_customer TYPE tt_customer + CHANGING ct_jobs TYPE tt_job. + METHODS aggregate + IMPORTING it_jobs TYPE tt_job + CHANGING ct_lines TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD read_jobs. + SELECT customer sheets amount + INTO CORRESPONDING FIELDS OF TABLE ct_jobs + FROM {{p}}prtjob + WHERE job_date >= iv_from + AND customer IN it_customer. + ENDMETHOD. + + METHOD aggregate. + FIELD-SYMBOLS TYPE ty_job. + FIELD-SYMBOLS TYPE ty_line. + + LOOP AT it_jobs ASSIGNING . + READ TABLE ct_lines ASSIGNING + WITH KEY customer = -customer. + IF sy-subrc <> 0. + APPEND INITIAL LINE TO ct_lines ASSIGNING . + -customer = -customer. + ENDIF. + -jobs = -jobs + 1. + -sheets = -sheets + -sheets. + -revenue = -revenue + -amount. + ENDLOOP. + + SORT ct_lines BY revenue DESCENDING customer ASCENDING. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + TRY. + cl_salv_table=>factory( + IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA lt_customer TYPE lcl_report=>tt_customer. + + CREATE OBJECT go_report. + lt_customer = s_cust[]. + go_report->read_jobs( + EXPORTING iv_from = p_from it_customer = lt_customer + CHANGING ct_jobs = lt_jobs ). + go_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + go_report->display( CHANGING ct_lines = lt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS aggregate_jobs FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD aggregate_jobs. + DATA lt_jobs TYPE lcl_report=>tt_job. + DATA ls_job TYPE lcl_report=>ty_job. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + DATA lo_report TYPE REF TO lcl_report. + DATA lv_count TYPE i. + DATA lv_amount TYPE {{p}}prtjob-amount. + DATA lv_customer TYPE {{p}}prtjob-customer. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 10. + ls_job-amount = 10. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'A'. + ls_job-sheets = 5. + ls_job-amount = 5. + APPEND ls_job TO lt_jobs. + + CLEAR ls_job. + ls_job-customer = 'B'. + ls_job-sheets = 20. + ls_job-amount = 40. + APPEND ls_job TO lt_jobs. + + CREATE OBJECT lo_report. + lo_report->aggregate( + EXPORTING it_jobs = lt_jobs + CHANGING ct_lines = lt_lines ). + + DESCRIBE TABLE lt_lines LINES lv_count. + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ). + + READ TABLE lt_lines INTO ls_line INDEX 1. + lv_customer = 'B'. + cl_abap_unit_assert=>assert_equals( exp = lv_customer act = ls_line-customer ). + lv_amount = 40. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + + READ TABLE lt_lines INTO ls_line INDEX 2. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-jobs ). + lv_amount = 15. + cl_abap_unit_assert=>assert_equals( exp = lv_amount act = ls_line-revenue ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0160/reference/vineyard_rpt.prog.abap b/tasks_gen/eval/G0160/reference/vineyard_rpt.prog.abap deleted file mode 100644 index cde4581..0000000 --- a/tasks_gen/eval/G0160/reference/vineyard_rpt.prog.abap +++ /dev/null @@ -1,203 +0,0 @@ -REPORT {{p}}vineyard_rpt. - -DATA gv_variety TYPE {{p}}grape-variety. - -PARAMETERS p_from TYPE d OBLIGATORY. -SELECT-OPTIONS s_var FOR gv_variety. - -CLASS lcl_vineyard DEFINITION FINAL. - PUBLIC SECTION. - TYPES tt_variety TYPE RANGE OF {{p}}grape-variety. - TYPES: BEGIN OF ty_harvest, - variety TYPE {{p}}harvest-variety, - harvest_date TYPE {{p}}harvest-harvest_date, - weight_kg TYPE {{p}}harvest-weight_kg, - END OF ty_harvest. - TYPES tt_harvest TYPE STANDARD TABLE OF ty_harvest. - TYPES: BEGIN OF ty_name, - variety TYPE {{p}}grape-variety, - name TYPE {{p}}grape-name, - END OF ty_name. - TYPES tt_name TYPE STANDARD TABLE OF ty_name. - TYPES: BEGIN OF ty_line, - variety TYPE {{p}}grape-variety, - name TYPE {{p}}grape-name, - total_kg TYPE {{p}}harvest-weight_kg, - harvests TYPE i, - END OF ty_line. - TYPES tt_line TYPE STANDARD TABLE OF ty_line. - - METHODS read_harvests - IMPORTING iv_from TYPE d - it_variety TYPE tt_variety - EXPORTING et_harvest TYPE tt_harvest. - METHODS read_names - IMPORTING it_harvest TYPE tt_harvest - EXPORTING et_names TYPE tt_name. - METHODS aggregate - IMPORTING it_harvest TYPE tt_harvest - it_names TYPE tt_name - EXPORTING et_lines TYPE tt_line. - METHODS display - CHANGING ct_lines TYPE tt_line. -ENDCLASS. - -CLASS lcl_vineyard IMPLEMENTATION. - METHOD read_harvests. - IF it_variety IS INITIAL. - SELECT variety harvest_date weight_kg - INTO TABLE et_harvest - FROM {{p}}harvest - WHERE harvest_date >= iv_from. - ELSE. - SELECT variety harvest_date weight_kg - INTO TABLE et_harvest - FROM {{p}}harvest - WHERE harvest_date >= iv_from - AND variety IN it_variety. - ENDIF. - ENDMETHOD. - - METHOD read_names. - IF it_harvest IS NOT INITIAL. - SELECT variety name - INTO TABLE et_names - FROM {{p}}grape - FOR ALL ENTRIES IN it_harvest - WHERE variety = it_harvest-variety. - ENDIF. - ENDMETHOD. - - METHOD aggregate. - DATA ls_harvest TYPE ty_harvest. - DATA ls_name TYPE ty_name. - DATA ls_line TYPE ty_line. - DATA lt_names TYPE tt_name. - DATA lt_lines TYPE tt_line. - lt_names = it_names. - SORT lt_names BY variety. - LOOP AT it_harvest INTO ls_harvest. - READ TABLE lt_names INTO ls_name - WITH KEY variety = ls_harvest-variety BINARY SEARCH. - IF sy-subrc = 0. - CLEAR ls_line. - ls_line-variety = ls_harvest-variety. - ls_line-name = ls_name-name. - ls_line-total_kg = ls_harvest-weight_kg. - ls_line-harvests = 1. - COLLECT ls_line INTO lt_lines. - ENDIF. - ENDLOOP. - SORT lt_lines BY total_kg DESCENDING. - et_lines = lt_lines. - ENDMETHOD. - - METHOD display. - DATA lo_alv TYPE REF TO cl_salv_table. - TRY. - cl_salv_table=>factory( - IMPORTING r_salv_table = lo_alv - CHANGING t_table = ct_lines ). - lo_alv->display( ). - CATCH cx_salv_msg. - MESSAGE 'Cannot display the list' TYPE 'I'. - ENDTRY. - ENDMETHOD. -ENDCLASS. - -START-OF-SELECTION. - DATA go_vineyard TYPE REF TO lcl_vineyard. - DATA lt_harvest TYPE lcl_vineyard=>tt_harvest. - DATA lt_names TYPE lcl_vineyard=>tt_name. - DATA lt_lines TYPE lcl_vineyard=>tt_line. - CREATE OBJECT go_vineyard. - go_vineyard->read_harvests( - EXPORTING iv_from = p_from it_variety = s_var[] - IMPORTING et_harvest = lt_harvest ). - go_vineyard->read_names( - EXPORTING it_harvest = lt_harvest - IMPORTING et_names = lt_names ). - go_vineyard->aggregate( - EXPORTING it_harvest = lt_harvest it_names = lt_names - IMPORTING et_lines = lt_lines ). - go_vineyard->display( CHANGING ct_lines = lt_lines ). - -CLASS ltc_vineyard DEFINITION FINAL FOR TESTING - DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - METHODS totals_per_variety FOR TESTING. - METHODS skips_unknown_variety FOR TESTING. -ENDCLASS. - -CLASS ltc_vineyard IMPLEMENTATION. - METHOD totals_per_variety. - DATA ls_harvest TYPE lcl_vineyard=>ty_harvest. - DATA lt_harvest TYPE lcl_vineyard=>tt_harvest. - DATA ls_name TYPE lcl_vineyard=>ty_name. - DATA lt_names TYPE lcl_vineyard=>tt_name. - DATA lt_lines TYPE lcl_vineyard=>tt_line. - DATA ls_line TYPE lcl_vineyard=>ty_line. - DATA lv_total TYPE {{p}}harvest-weight_kg. - DATA go_vineyard TYPE REF TO lcl_vineyard. - - ls_harvest-variety = 'A'. - ls_harvest-harvest_date = '20260101'. - ls_harvest-weight_kg = '10.000'. - APPEND ls_harvest TO lt_harvest. - - CLEAR ls_harvest. - ls_harvest-variety = 'A'. - ls_harvest-harvest_date = '20260102'. - ls_harvest-weight_kg = '5.000'. - APPEND ls_harvest TO lt_harvest. - - CLEAR ls_harvest. - ls_harvest-variety = 'B'. - ls_harvest-harvest_date = '20260101'. - ls_harvest-weight_kg = '2.000'. - APPEND ls_harvest TO lt_harvest. - - ls_name-variety = 'A'. - ls_name-name = 'Alpha'. - APPEND ls_name TO lt_names. - - CLEAR ls_name. - ls_name-variety = 'B'. - ls_name-name = 'Beta'. - APPEND ls_name TO lt_names. - - CREATE OBJECT go_vineyard. - go_vineyard->aggregate( - EXPORTING it_harvest = lt_harvest it_names = lt_names - IMPORTING et_lines = lt_lines ). - - cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). - READ TABLE lt_lines INTO ls_line INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'B' act = ls_line-variety ). - READ TABLE lt_lines INTO ls_line INDEX 2. - cl_abap_unit_assert=>assert_equals( exp = 'Alpha' act = ls_line-name ). - lv_total = '15.000'. - cl_abap_unit_assert=>assert_equals( exp = lv_total act = ls_line-total_kg ). - cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-harvests ). - ENDMETHOD. - - METHOD skips_unknown_variety. - DATA ls_harvest TYPE lcl_vineyard=>ty_harvest. - DATA lt_harvest TYPE lcl_vineyard=>tt_harvest. - DATA lt_names TYPE lcl_vineyard=>tt_name. - DATA lt_lines TYPE lcl_vineyard=>tt_line. - DATA go_vineyard TYPE REF TO lcl_vineyard. - - ls_harvest-variety = 'X'. - ls_harvest-harvest_date = '20260101'. - ls_harvest-weight_kg = '1.000'. - APPEND ls_harvest TO lt_harvest. - - CREATE OBJECT go_vineyard. - go_vineyard->aggregate( - EXPORTING it_harvest = lt_harvest it_names = lt_names - IMPORTING et_lines = lt_lines ). - - cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_lines ) ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0160/seed/grape.tabl.asabap b/tasks_gen/eval/G0160/seed/grape.tabl.asabap deleted file mode 100644 index 6464ccb..0000000 --- a/tasks_gen/eval/G0160/seed/grape.tabl.asabap +++ /dev/null @@ -1,10 +0,0 @@ -@EndUserText.label : 'Grape variety' -@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE -@AbapCatalog.tableCategory : #TRANSPARENT -@AbapCatalog.deliveryClass : #A -@AbapCatalog.dataMaintenance : #RESTRICTED -define table {{p}}grape { - key client : abap.clnt not null; - key variety : abap.char(4) not null; - name : abap.char(40); -} diff --git a/tasks_gen/eval/G0160/seed/harvest.tabl.asabap b/tasks_gen/eval/G0160/seed/harvest.tabl.asabap deleted file mode 100644 index a5010c9..0000000 --- a/tasks_gen/eval/G0160/seed/harvest.tabl.asabap +++ /dev/null @@ -1,12 +0,0 @@ -@EndUserText.label : 'Grape harvest' -@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE -@AbapCatalog.tableCategory : #TRANSPARENT -@AbapCatalog.deliveryClass : #A -@AbapCatalog.dataMaintenance : #RESTRICTED -define table {{p}}harvest { - key client : abap.clnt not null; - key harvest_id : abap.int4 not null; - variety : abap.char(4); - harvest_date : abap.dats; - weight_kg : abap.dec(13,3); -} diff --git a/tasks_gen/eval/G0160/seed/prtjob.tabl.asabap b/tasks_gen/eval/G0160/seed/prtjob.tabl.asabap new file mode 100644 index 0000000..a77b0b3 --- /dev/null +++ b/tasks_gen/eval/G0160/seed/prtjob.tabl.asabap @@ -0,0 +1,13 @@ +@EndUserText.label : 'Print jobs' +@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE +@AbapCatalog.tableCategory : #TRANSPARENT +@AbapCatalog.deliveryClass : #A +@AbapCatalog.dataMaintenance : #RESTRICTED +define table {{p}}prtjob { + key client : abap.clnt not null; + key job_id : abap.int4 not null; + customer : abap.char(10); + job_date : abap.dats; + sheets : abap.int4; + amount : abap.dec(15,2); +} diff --git a/tasks_gen/eval/G0160/seed/t31_seed.clas.abap b/tasks_gen/eval/G0160/seed/t31_seed.clas.abap new file mode 100644 index 0000000..97b3ca4 --- /dev/null +++ b/tasks_gen/eval/G0160/seed/t31_seed.clas.abap @@ -0,0 +1,56 @@ +CLASS {{p}}t31_seed DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES if_oo_adt_classrun. +ENDCLASS. + +CLASS {{p}}t31_seed IMPLEMENTATION. + METHOD if_oo_adt_classrun~main. + DATA lt_job TYPE STANDARD TABLE OF {{p}}prtjob. + DATA ls_job TYPE {{p}}prtjob. + + DELETE FROM {{p}}prtjob. + + CLEAR ls_job. + ls_job-job_id = 1. + ls_job-customer = 'ALPHA'. + ls_job-job_date = '20260105'. + ls_job-sheets = 100. + ls_job-amount = 250. + APPEND ls_job TO lt_job. + + CLEAR ls_job. + ls_job-job_id = 2. + ls_job-customer = 'ALPHA'. + ls_job-job_date = '20260210'. + ls_job-sheets = 50. + ls_job-amount = 100. + APPEND ls_job TO lt_job. + + CLEAR ls_job. + ls_job-job_id = 3. + ls_job-customer = 'BETA'. + ls_job-job_date = '20260120'. + ls_job-sheets = 200. + ls_job-amount = 350. + APPEND ls_job TO lt_job. + + CLEAR ls_job. + ls_job-job_id = 4. + ls_job-customer = 'GAMMA'. + ls_job-job_date = '20251220'. + ls_job-sheets = 400. + ls_job-amount = 500. + APPEND ls_job TO lt_job. + + CLEAR ls_job. + ls_job-job_id = 5. + ls_job-customer = 'GAMMA'. + ls_job-job_date = '20260301'. + ls_job-sheets = 10. + ls_job-amount = 20. + APPEND ls_job TO lt_job. + + INSERT {{p}}prtjob FROM TABLE lt_job. + out->write( sy-dbcnt ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0160/seed/vine_seed.clas.abap b/tasks_gen/eval/G0160/seed/vine_seed.clas.abap deleted file mode 100644 index 497bb5c..0000000 --- a/tasks_gen/eval/G0160/seed/vine_seed.clas.abap +++ /dev/null @@ -1,95 +0,0 @@ -CLASS {{p}}vine_seed DEFINITION PUBLIC FINAL CREATE PUBLIC. - PUBLIC SECTION. - INTERFACES if_oo_adt_classrun. -ENDCLASS. - -CLASS {{p}}vine_seed IMPLEMENTATION. - METHOD if_oo_adt_classrun~main. - DATA lt_grape TYPE STANDARD TABLE OF {{p}}grape. - DATA lt_harvest TYPE STANDARD TABLE OF {{p}}harvest. - DATA ls_grape TYPE {{p}}grape. - DATA ls_harvest TYPE {{p}}harvest. - - DELETE FROM {{p}}harvest. - DELETE FROM {{p}}grape. - - CLEAR ls_grape. - ls_grape-client = sy-mandt. - ls_grape-variety = 'MERL'. - ls_grape-name = 'Merlot'. - APPEND ls_grape TO lt_grape. - - CLEAR ls_grape. - ls_grape-client = sy-mandt. - ls_grape-variety = 'CHRD'. - ls_grape-name = 'Chardonnay'. - APPEND ls_grape TO lt_grape. - - CLEAR ls_grape. - ls_grape-client = sy-mandt. - ls_grape-variety = 'RIES'. - ls_grape-name = 'Riesling'. - APPEND ls_grape TO lt_grape. - - CLEAR ls_harvest. - ls_harvest-client = sy-mandt. - ls_harvest-harvest_id = 1. - ls_harvest-variety = 'MERL'. - ls_harvest-harvest_date = '20260901'. - ls_harvest-weight_kg = '1200.500'. - APPEND ls_harvest TO lt_harvest. - - CLEAR ls_harvest. - ls_harvest-client = sy-mandt. - ls_harvest-harvest_id = 2. - ls_harvest-variety = 'MERL'. - ls_harvest-harvest_date = '20260910'. - ls_harvest-weight_kg = '800.000'. - APPEND ls_harvest TO lt_harvest. - - CLEAR ls_harvest. - ls_harvest-client = sy-mandt. - ls_harvest-harvest_id = 3. - ls_harvest-variety = 'CHRD'. - ls_harvest-harvest_date = '20260905'. - ls_harvest-weight_kg = '2000.000'. - APPEND ls_harvest TO lt_harvest. - - CLEAR ls_harvest. - ls_harvest-client = sy-mandt. - ls_harvest-harvest_id = 4. - ls_harvest-variety = 'CHRD'. - ls_harvest-harvest_date = '20261001'. - ls_harvest-weight_kg = '300.000'. - APPEND ls_harvest TO lt_harvest. - - CLEAR ls_harvest. - ls_harvest-client = sy-mandt. - ls_harvest-harvest_id = 5. - ls_harvest-variety = 'RIES'. - ls_harvest-harvest_date = '20251215'. - ls_harvest-weight_kg = '250.000'. - APPEND ls_harvest TO lt_harvest. - - CLEAR ls_harvest. - ls_harvest-client = sy-mandt. - ls_harvest-harvest_id = 6. - ls_harvest-variety = 'RIES'. - ls_harvest-harvest_date = '20260820'. - ls_harvest-weight_kg = '500.000'. - APPEND ls_harvest TO lt_harvest. - - CLEAR ls_harvest. - ls_harvest-client = sy-mandt. - ls_harvest-harvest_id = 7. - ls_harvest-variety = 'SYRA'. - ls_harvest-harvest_date = '20260915'. - ls_harvest-weight_kg = '100.000'. - APPEND ls_harvest TO lt_harvest. - - INSERT {{p}}grape FROM TABLE lt_grape. - INSERT {{p}}harvest FROM TABLE lt_harvest. - - out->write( sy-dbcnt ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0160/spec.md b/tasks_gen/eval/G0160/spec.md index f2a6eaf..a2f4236 100644 --- a/tasks_gen/eval/G0160/spec.md +++ b/tasks_gen/eval/G0160/spec.md @@ -1,44 +1,37 @@ # 1. Goal -Show the harvest weight of each grape variety in an ALV list. The winery uses the -list to compare the varieties for a period. +A print shop prints jobs for its customers. The sales team needs a report that +shows, for each customer, the number of jobs and the revenue of a period. # 2. Open questions None. # 3. Context -- Table {{P}}GRAPE exists in package $TMP. It contains data. - Fields: VARIETY (CHAR 4, key), NAME (CHAR 40). -- Table {{P}}HARVEST exists in package $TMP. It contains data. - Fields: HARVEST_ID (INT4, key), VARIETY (CHAR 4), HARVEST_DATE (DATS), - WEIGHT_KG (DEC 13,3). +- Table {{P}}PRTJOB exists in package $TMP. It contains data. + Fields: JOB_ID (INT4, key), CUSTOMER (CHAR 10), JOB_DATE (DATS), + SHEETS (INT4), AMOUNT (DEC 15,2). # 4. Contract -- Create the executable program {{P}}VINEYARD_RPT in package $TMP. +- Create the executable program {{P}}PRINT_SUM in package $TMP. - Selection screen: - - Parameter P_FROM, type DATS, mandatory: the first harvest date to include. - - Select-option S_VAR for the variety. + - Parameter P_FROM, type DATS, obligatory: the first job date to include. + - Select-option S_CUST for the customer. - Show the result with CL_SALV_TABLE. The output table has these columns, with - these names: VARIETY, NAME, TOTAL_KG (the sum of WEIGHT_KG), HARVESTS (the - number of harvests). + these names: CUSTOMER, JOBS, SHEETS, REVENUE. # 5. Business rules -1. Include a harvest only if HARVEST_DATE is on or after P_FROM and VARIETY is - in S_VAR. An empty S_VAR does not restrict the variety. -2. Show a variety only if it has an entry in {{P}}GRAPE. A variety with harvests - but without an entry in {{P}}GRAPE is not shown. -3. Show one line for each variety with at least one included harvest. -4. NAME is the name of the variety from {{P}}GRAPE. -5. Sort the lines by TOTAL_KG, the highest total first. +1. Include a job only if JOB_DATE is on or after P_FROM and CUSTOMER is in S_CUST. +2. Show one line for each customer that has at least one included job. +3. JOBS is the number of included jobs of the customer. +4. SHEETS is the sum of the SHEETS values of the included jobs of the customer. +5. REVENUE is the sum of the AMOUNT values of the included jobs of the customer. +6. Sort the lines by REVENUE, the highest revenue first. If two customers have + the same revenue, sort these two customers by CUSTOMER in ascending order. # 6. Constraints -- Release target: 7.02. Use only ABAP syntax that is available in release 7.02. - Do not use syntax elements that were introduced in a later release. Examples of - syntax that you must not use: inline declarations, constructor expressions - (NEW, VALUE, CONV), string templates, table expressions, SQL expressions and - SQL aggregate functions, GROUP BY, UNION, the escape character @ in ABAP SQL, - WITH EMPTY KEY. -- Coding standards: Clean ABAP. Do not read the database inside a loop. -- Out of scope: do not change {{P}}GRAPE or {{P}}HARVEST. +- Release target: 7.02. Write the program in ABAP and ABAP SQL syntax that + release 7.02 supports. Do not use syntax that is newer than 7.02. +- Coding standards: Clean ABAP. Read the data with one database access. +- Out of scope: do not change {{P}}PRTJOB. # 7. Acceptance - The program is active and has no syntax error. diff --git a/tasks_gen/eval/G0160/task.json b/tasks_gen/eval/G0160/task.json index b40bcf0..8c75198 100644 --- a/tasks_gen/eval/G0160/task.json +++ b/tasks_gen/eval/G0160/task.json @@ -6,58 +6,51 @@ "release_target": "v702", "expected_outcome": "implement", "budget": { - "max_tool_calls": 40, - "max_activations": 10 + "max_tool_calls": 60, + "max_activations": 15 }, "seed": [ { "type": "TABL", - "name": "{{P}}GRAPE", - "file": "seed/grape.tabl.asabap", - "description": "Grape varieties" - }, - { - "type": "TABL", - "name": "{{P}}HARVEST", - "file": "seed/harvest.tabl.asabap", - "description": "Grape harvests" + "name": "{{P}}PRTJOB", + "file": "seed/prtjob.tabl.asabap", + "description": "Print jobs of the print shop" }, { "type": "CLAS", - "name": "{{P}}VINE_SEED", - "file": "seed/vine_seed.clas.abap", - "description": "Vineyard seed data", + "name": "{{P}}T31_SEED", + "file": "seed/t31_seed.clas.abap", + "description": "T31 seed data", "run": true } ], "contract": [ { "type": "PROG", - "name": "{{P}}VINEYARD_RPT", + "name": "{{P}}PRINT_SUM", "parameters": [ "p_from", - "s_var" + "s_cust" ] } ], "out_of_scope": [ - "{{P}}GRAPE", - "{{P}}HARVEST" + "{{P}}PRTJOB" ], "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}VINE_HIDDEN", - "file": "hidden/vine_hidden.clas.abap", - "description": "Hidden tests for the vineyard harvest report" + "name": "{{P}}T31_HIDDEN", + "file": "hidden/t31_hidden.clas.abap", + "description": "T31 hidden tests" } ], "reference": [ { "type": "PROG", - "name": "{{P}}VINEYARD_RPT", - "file": "reference/vineyard_rpt.prog.abap", - "description": "Harvest weight per grape variety" + "name": "{{P}}PRINT_SUM", + "file": "reference/print_sum.prog.abap", + "description": "Print volume and revenue per customer" } ], "craft_checks": [ diff --git a/tasks_gen/eval/G0161/empirical.json b/tasks_gen/eval/G0161/empirical.json new file mode 100644 index 0000000..d1e8829 --- /dev/null +++ b/tasks_gen/eval/G0161/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "failed_gates": [ + "G1_active", + "G2_contract", + "G3_hidden_runs", + "G6_release" + ] + }, + "hidden": "0/0", + "tool_calls": 35, + "seconds": 670.3, + "run_dir": "runs/emp/11030_G0161_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0161/faulty/m0_ward_stay.prog.abap b/tasks_gen/eval/G0161/faulty/m0_ward_stay.prog.abap new file mode 100644 index 0000000..dda2162 --- /dev/null +++ b/tasks_gen/eval/G0161/faulty/m0_ward_stay.prog.abap @@ -0,0 +1,193 @@ +REPORT {{p}}ward_stay. + +TYPES ty_ward TYPE {{p}}admit-ward. + +DATA gv_ward TYPE ty_ward. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_ward FOR gv_ward. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_admit, + adm_id TYPE {{p}}admit-adm_id, + ward TYPE {{p}}admit-ward, + admit_date TYPE {{p}}admit-admit_date, + discharge_date TYPE {{p}}admit-discharge_date, + daily_rate TYPE {{p}}admit-daily_rate, + END OF ty_admit, + tt_admit TYPE STANDARD TABLE OF ty_admit WITH EMPTY KEY, + BEGIN OF ty_line, + ward TYPE {{p}}admit-ward, + admissions TYPE i, + bed_days TYPE i, + total_cost TYPE {{p}}admit-daily_rate, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_ward TYPE RANGE OF {{p}}admit-ward. + METHODS select_stays + IMPORTING iv_from TYPE d + iv_to TYPE d + it_ward TYPE tt_ward + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS aggregate + IMPORTING it_admit TYPE tt_admit + iv_to TYPE d + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + METHODS add_admission + IMPORTING is_admit TYPE ty_admit + iv_to TYPE d + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_stays. + DATA lt_admit TYPE tt_admit. + + SELECT adm_id, ward, admit_date, discharge_date, daily_rate + FROM {{p}}admit + WHERE admit_date >= @iv_from + AND admit_date > @iv_to + AND ward IN @it_ward + INTO TABLE @lt_admit. + + rt_lines = aggregate( it_admit = lt_admit + iv_to = iv_to ). + ENDMETHOD. + + METHOD aggregate. + DATA ls_admit TYPE ty_admit. + + LOOP AT it_admit INTO ls_admit. + add_admission( EXPORTING is_admit = ls_admit + iv_to = iv_to + CHANGING ct_lines = rt_lines ). + ENDLOOP. + + SORT rt_lines BY total_cost DESCENDING. + ENDMETHOD. + + METHOD add_admission. + DATA lv_discharge TYPE d. + DATA lv_days TYPE i. + DATA lv_cost TYPE {{p}}admit-daily_rate. + DATA lv_index TYPE i. + DATA ls_line TYPE ty_line. + + lv_discharge = is_admit-discharge_date. + IF lv_discharge IS INITIAL. + lv_discharge = iv_to. + ENDIF. + + lv_days = lv_discharge - is_admit-admit_date. + lv_cost = lv_days * is_admit-daily_rate. + + READ TABLE ct_lines INTO ls_line WITH KEY ward = is_admit-ward. + IF sy-subrc = 0. + lv_index = sy-tabix. + ELSE. + CLEAR ls_line. + ls_line-ward = is_admit-ward. + APPEND ls_line TO ct_lines. + lv_index = lines( ct_lines ). + ENDIF. + + ls_line-admissions = ls_line-admissions + 1. + ls_line-bed_days = ls_line-bed_days + lv_days. + ls_line-total_cost = ls_line-total_cost + lv_cost. + MODIFY ct_lines INDEX lv_index FROM ls_line. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA gt_lines TYPE lcl_report=>tt_line. + + go_report = NEW lcl_report( ). + gt_lines = go_report->select_stays( iv_from = p_from + iv_to = p_to + it_ward = s_ward[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS open_stay_uses_p_to FOR TESTING. + METHODS totals_per_ward FOR TESTING. + METHODS sorted_by_cost FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD open_stay_uses_p_to. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '00000000' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260105' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_line-bed_days ). + cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}admit-daily_rate( 40 ) + act = ls_line-total_cost ). + ENDMETHOD. + + METHOD totals_per_ward. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'A' admit_date = '20260105' + discharge_date = '20260106' daily_rate = '10.00' ) + ( adm_id = 3 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '5.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + + READ TABLE lt_lines INTO ls_line WITH KEY ward = 'A'. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-admissions ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_line-bed_days ). + ENDMETHOD. + + METHOD sorted_by_cost. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 'B' act = ls_line-ward ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0161/faulty/m1_ward_stay.prog.abap b/tasks_gen/eval/G0161/faulty/m1_ward_stay.prog.abap new file mode 100644 index 0000000..a3aeb6c --- /dev/null +++ b/tasks_gen/eval/G0161/faulty/m1_ward_stay.prog.abap @@ -0,0 +1,193 @@ +REPORT {{p}}ward_stay. + +TYPES ty_ward TYPE {{p}}admit-ward. + +DATA gv_ward TYPE ty_ward. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_ward FOR gv_ward. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_admit, + adm_id TYPE {{p}}admit-adm_id, + ward TYPE {{p}}admit-ward, + admit_date TYPE {{p}}admit-admit_date, + discharge_date TYPE {{p}}admit-discharge_date, + daily_rate TYPE {{p}}admit-daily_rate, + END OF ty_admit, + tt_admit TYPE STANDARD TABLE OF ty_admit WITH EMPTY KEY, + BEGIN OF ty_line, + ward TYPE {{p}}admit-ward, + admissions TYPE i, + bed_days TYPE i, + total_cost TYPE {{p}}admit-daily_rate, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_ward TYPE RANGE OF {{p}}admit-ward. + METHODS select_stays + IMPORTING iv_from TYPE d + iv_to TYPE d + it_ward TYPE tt_ward + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS aggregate + IMPORTING it_admit TYPE tt_admit + iv_to TYPE d + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + METHODS add_admission + IMPORTING is_admit TYPE ty_admit + iv_to TYPE d + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_stays. + DATA lt_admit TYPE tt_admit. + + SELECT adm_id, ward, admit_date, discharge_date, daily_rate + FROM {{p}}admit + WHERE admit_date >= @iv_from + AND admit_date <= @iv_to + OR ward IN @it_ward + INTO TABLE @lt_admit. + + rt_lines = aggregate( it_admit = lt_admit + iv_to = iv_to ). + ENDMETHOD. + + METHOD aggregate. + DATA ls_admit TYPE ty_admit. + + LOOP AT it_admit INTO ls_admit. + add_admission( EXPORTING is_admit = ls_admit + iv_to = iv_to + CHANGING ct_lines = rt_lines ). + ENDLOOP. + + SORT rt_lines BY total_cost DESCENDING. + ENDMETHOD. + + METHOD add_admission. + DATA lv_discharge TYPE d. + DATA lv_days TYPE i. + DATA lv_cost TYPE {{p}}admit-daily_rate. + DATA lv_index TYPE i. + DATA ls_line TYPE ty_line. + + lv_discharge = is_admit-discharge_date. + IF lv_discharge IS INITIAL. + lv_discharge = iv_to. + ENDIF. + + lv_days = lv_discharge - is_admit-admit_date. + lv_cost = lv_days * is_admit-daily_rate. + + READ TABLE ct_lines INTO ls_line WITH KEY ward = is_admit-ward. + IF sy-subrc = 0. + lv_index = sy-tabix. + ELSE. + CLEAR ls_line. + ls_line-ward = is_admit-ward. + APPEND ls_line TO ct_lines. + lv_index = lines( ct_lines ). + ENDIF. + + ls_line-admissions = ls_line-admissions + 1. + ls_line-bed_days = ls_line-bed_days + lv_days. + ls_line-total_cost = ls_line-total_cost + lv_cost. + MODIFY ct_lines INDEX lv_index FROM ls_line. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA gt_lines TYPE lcl_report=>tt_line. + + go_report = NEW lcl_report( ). + gt_lines = go_report->select_stays( iv_from = p_from + iv_to = p_to + it_ward = s_ward[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS open_stay_uses_p_to FOR TESTING. + METHODS totals_per_ward FOR TESTING. + METHODS sorted_by_cost FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD open_stay_uses_p_to. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '00000000' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260105' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_line-bed_days ). + cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}admit-daily_rate( 40 ) + act = ls_line-total_cost ). + ENDMETHOD. + + METHOD totals_per_ward. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'A' admit_date = '20260105' + discharge_date = '20260106' daily_rate = '10.00' ) + ( adm_id = 3 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '5.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + + READ TABLE lt_lines INTO ls_line WITH KEY ward = 'A'. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-admissions ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_line-bed_days ). + ENDMETHOD. + + METHOD sorted_by_cost. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 'B' act = ls_line-ward ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0161/faulty/m2_ward_stay.prog.abap b/tasks_gen/eval/G0161/faulty/m2_ward_stay.prog.abap new file mode 100644 index 0000000..58cb813 --- /dev/null +++ b/tasks_gen/eval/G0161/faulty/m2_ward_stay.prog.abap @@ -0,0 +1,193 @@ +REPORT {{p}}ward_stay. + +TYPES ty_ward TYPE {{p}}admit-ward. + +DATA gv_ward TYPE ty_ward. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_ward FOR gv_ward. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_admit, + adm_id TYPE {{p}}admit-adm_id, + ward TYPE {{p}}admit-ward, + admit_date TYPE {{p}}admit-admit_date, + discharge_date TYPE {{p}}admit-discharge_date, + daily_rate TYPE {{p}}admit-daily_rate, + END OF ty_admit, + tt_admit TYPE STANDARD TABLE OF ty_admit WITH EMPTY KEY, + BEGIN OF ty_line, + ward TYPE {{p}}admit-ward, + admissions TYPE i, + bed_days TYPE i, + total_cost TYPE {{p}}admit-daily_rate, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_ward TYPE RANGE OF {{p}}admit-ward. + METHODS select_stays + IMPORTING iv_from TYPE d + iv_to TYPE d + it_ward TYPE tt_ward + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS aggregate + IMPORTING it_admit TYPE tt_admit + iv_to TYPE d + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + METHODS add_admission + IMPORTING is_admit TYPE ty_admit + iv_to TYPE d + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_stays. + DATA lt_admit TYPE tt_admit. + + SELECT adm_id, ward, admit_date, discharge_date, daily_rate + FROM {{p}}admit + WHERE admit_date >= @iv_from + AND admit_date <= @iv_to + AND ward IN @it_ward + INTO TABLE @lt_admit. + + rt_lines = aggregate( it_admit = lt_admit + iv_to = iv_to ). + ENDMETHOD. + + METHOD aggregate. + DATA ls_admit TYPE ty_admit. + + LOOP AT it_admit INTO ls_admit. + add_admission( EXPORTING is_admit = ls_admit + iv_to = iv_to + CHANGING ct_lines = rt_lines ). + ENDLOOP. + + SORT rt_lines BY total_cost DESCENDING. + ENDMETHOD. + + METHOD add_admission. + DATA lv_discharge TYPE d. + DATA lv_days TYPE i. + DATA lv_cost TYPE {{p}}admit-daily_rate. + DATA lv_index TYPE i. + DATA ls_line TYPE ty_line. + + lv_discharge = is_admit-discharge_date. + IF lv_discharge IS INITIAL. + lv_discharge = iv_to. + ENDIF. + + lv_days = lv_discharge - is_admit-admit_date. + lv_cost = lv_days * is_admit-daily_rate. + + READ TABLE ct_lines INTO ls_line WITH KEY ward = is_admit-ward. + IF sy-subrc = 0. + lv_index = sy-tabix. + ELSE. + CLEAR ls_line. + ls_line-ward = is_admit-ward. + APPEND ls_line TO ct_lines. + lv_index = lines( ct_lines ). + ENDIF. + + ls_line-admissions = ls_line-admissions - 1. + ls_line-bed_days = ls_line-bed_days + lv_days. + ls_line-total_cost = ls_line-total_cost + lv_cost. + MODIFY ct_lines INDEX lv_index FROM ls_line. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA gt_lines TYPE lcl_report=>tt_line. + + go_report = NEW lcl_report( ). + gt_lines = go_report->select_stays( iv_from = p_from + iv_to = p_to + it_ward = s_ward[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS open_stay_uses_p_to FOR TESTING. + METHODS totals_per_ward FOR TESTING. + METHODS sorted_by_cost FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD open_stay_uses_p_to. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '00000000' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260105' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_line-bed_days ). + cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}admit-daily_rate( 40 ) + act = ls_line-total_cost ). + ENDMETHOD. + + METHOD totals_per_ward. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'A' admit_date = '20260105' + discharge_date = '20260106' daily_rate = '10.00' ) + ( adm_id = 3 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '5.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + + READ TABLE lt_lines INTO ls_line WITH KEY ward = 'A'. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-admissions ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_line-bed_days ). + ENDMETHOD. + + METHOD sorted_by_cost. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 'B' act = ls_line-ward ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0161/faulty/m3_ward_stay.prog.abap b/tasks_gen/eval/G0161/faulty/m3_ward_stay.prog.abap new file mode 100644 index 0000000..6982601 --- /dev/null +++ b/tasks_gen/eval/G0161/faulty/m3_ward_stay.prog.abap @@ -0,0 +1,193 @@ +REPORT {{p}}ward_stay. + +TYPES ty_ward TYPE {{p}}admit-ward. + +DATA gv_ward TYPE ty_ward. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_ward FOR gv_ward. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_admit, + adm_id TYPE {{p}}admit-adm_id, + ward TYPE {{p}}admit-ward, + admit_date TYPE {{p}}admit-admit_date, + discharge_date TYPE {{p}}admit-discharge_date, + daily_rate TYPE {{p}}admit-daily_rate, + END OF ty_admit, + tt_admit TYPE STANDARD TABLE OF ty_admit WITH EMPTY KEY, + BEGIN OF ty_line, + ward TYPE {{p}}admit-ward, + admissions TYPE i, + bed_days TYPE i, + total_cost TYPE {{p}}admit-daily_rate, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_ward TYPE RANGE OF {{p}}admit-ward. + METHODS select_stays + IMPORTING iv_from TYPE d + iv_to TYPE d + it_ward TYPE tt_ward + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS aggregate + IMPORTING it_admit TYPE tt_admit + iv_to TYPE d + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + METHODS add_admission + IMPORTING is_admit TYPE ty_admit + iv_to TYPE d + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_stays. + DATA lt_admit TYPE tt_admit. + + SELECT adm_id, ward, admit_date, discharge_date, daily_rate + FROM {{p}}admit + WHERE admit_date >= @iv_from + AND admit_date <= @iv_to + AND ward IN @it_ward + INTO TABLE @lt_admit. + + rt_lines = aggregate( it_admit = lt_admit + iv_to = iv_to ). + ENDMETHOD. + + METHOD aggregate. + DATA ls_admit TYPE ty_admit. + + LOOP AT it_admit INTO ls_admit. + add_admission( EXPORTING is_admit = ls_admit + iv_to = iv_to + CHANGING ct_lines = rt_lines ). + ENDLOOP. + + SORT rt_lines BY total_cost DESCENDING. + ENDMETHOD. + + METHOD add_admission. + DATA lv_discharge TYPE d. + DATA lv_days TYPE i. + DATA lv_cost TYPE {{p}}admit-daily_rate. + DATA lv_index TYPE i. + DATA ls_line TYPE ty_line. + + lv_discharge = is_admit-discharge_date. + IF lv_discharge IS INITIAL. + lv_discharge = iv_to. + ENDIF. + + lv_days = lv_discharge - is_admit-admit_date. + lv_cost = lv_days * is_admit-daily_rate. + + READ TABLE ct_lines INTO ls_line WITH KEY ward = is_admit-ward. + IF sy-subrc = 0. + lv_index = sy-tabix. + ELSE. + CLEAR ls_line. + ls_line-ward = is_admit-ward. + APPEND ls_line TO ct_lines. + lv_index = lines( ct_lines ). + ENDIF. + + ls_line-admissions = ls_line-admissions + 1. + ls_line-bed_days = ls_line-bed_days - lv_days. + ls_line-total_cost = ls_line-total_cost + lv_cost. + MODIFY ct_lines INDEX lv_index FROM ls_line. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA gt_lines TYPE lcl_report=>tt_line. + + go_report = NEW lcl_report( ). + gt_lines = go_report->select_stays( iv_from = p_from + iv_to = p_to + it_ward = s_ward[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS open_stay_uses_p_to FOR TESTING. + METHODS totals_per_ward FOR TESTING. + METHODS sorted_by_cost FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD open_stay_uses_p_to. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '00000000' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260105' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_line-bed_days ). + cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}admit-daily_rate( 40 ) + act = ls_line-total_cost ). + ENDMETHOD. + + METHOD totals_per_ward. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'A' admit_date = '20260105' + discharge_date = '20260106' daily_rate = '10.00' ) + ( adm_id = 3 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '5.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + + READ TABLE lt_lines INTO ls_line WITH KEY ward = 'A'. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-admissions ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_line-bed_days ). + ENDMETHOD. + + METHOD sorted_by_cost. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 'B' act = ls_line-ward ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0161/faulty/m4_ward_stay.prog.abap b/tasks_gen/eval/G0161/faulty/m4_ward_stay.prog.abap new file mode 100644 index 0000000..7520916 --- /dev/null +++ b/tasks_gen/eval/G0161/faulty/m4_ward_stay.prog.abap @@ -0,0 +1,193 @@ +REPORT {{p}}ward_stay. + +TYPES ty_ward TYPE {{p}}admit-ward. + +DATA gv_ward TYPE ty_ward. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_ward FOR gv_ward. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_admit, + adm_id TYPE {{p}}admit-adm_id, + ward TYPE {{p}}admit-ward, + admit_date TYPE {{p}}admit-admit_date, + discharge_date TYPE {{p}}admit-discharge_date, + daily_rate TYPE {{p}}admit-daily_rate, + END OF ty_admit, + tt_admit TYPE STANDARD TABLE OF ty_admit WITH EMPTY KEY, + BEGIN OF ty_line, + ward TYPE {{p}}admit-ward, + admissions TYPE i, + bed_days TYPE i, + total_cost TYPE {{p}}admit-daily_rate, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_ward TYPE RANGE OF {{p}}admit-ward. + METHODS select_stays + IMPORTING iv_from TYPE d + iv_to TYPE d + it_ward TYPE tt_ward + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS aggregate + IMPORTING it_admit TYPE tt_admit + iv_to TYPE d + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + METHODS add_admission + IMPORTING is_admit TYPE ty_admit + iv_to TYPE d + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_stays. + DATA lt_admit TYPE tt_admit. + + SELECT adm_id, ward, admit_date, discharge_date, daily_rate + FROM {{p}}admit + WHERE admit_date >= @iv_from + AND admit_date <= @iv_to + AND ward IN @it_ward + INTO TABLE @lt_admit. + + rt_lines = aggregate( it_admit = lt_admit + iv_to = iv_to ). + ENDMETHOD. + + METHOD aggregate. + DATA ls_admit TYPE ty_admit. + + LOOP AT it_admit INTO ls_admit. + add_admission( EXPORTING is_admit = ls_admit + iv_to = iv_to + CHANGING ct_lines = rt_lines ). + ENDLOOP. + + SORT rt_lines BY total_cost DESCENDING. + ENDMETHOD. + + METHOD add_admission. + DATA lv_discharge TYPE d. + DATA lv_days TYPE i. + DATA lv_cost TYPE {{p}}admit-daily_rate. + DATA lv_index TYPE i. + DATA ls_line TYPE ty_line. + + lv_discharge = is_admit-discharge_date. + IF lv_discharge IS INITIAL. + lv_discharge = iv_to. + ENDIF. + + lv_days = lv_discharge - is_admit-admit_date. + lv_cost = lv_days * is_admit-daily_rate. + + READ TABLE ct_lines INTO ls_line WITH KEY ward = is_admit-ward. + IF sy-subrc = 0. + lv_index = sy-tabix. + ELSE. + CLEAR ls_line. + ls_line-ward = is_admit-ward. + APPEND ls_line TO ct_lines. + lv_index = lines( ct_lines ). + ENDIF. + + ls_line-admissions = ls_line-admissions + 1. + ls_line-bed_days = ls_line-bed_days + lv_days. + ls_line-total_cost = ls_line-total_cost - lv_cost. + MODIFY ct_lines INDEX lv_index FROM ls_line. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA gt_lines TYPE lcl_report=>tt_line. + + go_report = NEW lcl_report( ). + gt_lines = go_report->select_stays( iv_from = p_from + iv_to = p_to + it_ward = s_ward[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS open_stay_uses_p_to FOR TESTING. + METHODS totals_per_ward FOR TESTING. + METHODS sorted_by_cost FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD open_stay_uses_p_to. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '00000000' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260105' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_line-bed_days ). + cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}admit-daily_rate( 40 ) + act = ls_line-total_cost ). + ENDMETHOD. + + METHOD totals_per_ward. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'A' admit_date = '20260105' + discharge_date = '20260106' daily_rate = '10.00' ) + ( adm_id = 3 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '5.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + + READ TABLE lt_lines INTO ls_line WITH KEY ward = 'A'. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-admissions ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_line-bed_days ). + ENDMETHOD. + + METHOD sorted_by_cost. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 'B' act = ls_line-ward ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0161/generation.json b/tasks_gen/eval/G0161/generation.json new file mode 100644 index 0000000..46c9462 --- /dev/null +++ b/tasks_gen/eval/G0161/generation.json @@ -0,0 +1,19 @@ +{ + "id": "G0161", + "pool": "eval", + "object_type": "PROG", + "category": "G", + "attempts": [ + { + "stage": "validate", + "oracle": 100.0, + "null": 0, + "mutation": { + "valid": 5, + "killed": 5, + "ok": true + } + } + ], + "accepted": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0161/hidden/ward_hidden.clas.abap b/tasks_gen/eval/G0161/hidden/ward_hidden.clas.abap new file mode 100644 index 0000000..30f17a8 --- /dev/null +++ b/tasks_gen/eval/G0161/hidden/ward_hidden.clas.abap @@ -0,0 +1,139 @@ +CLASS {{p}}ward_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + TYPES tt_ward TYPE RANGE OF {{p}}admit-ward. + + METHODS run + IMPORTING iv_from TYPE d + iv_to TYPE d + it_ward TYPE tt_ward OPTIONAL + RETURNING VALUE(rr_data) TYPE REF TO data. + + METHODS lines_of + IMPORTING ir_data TYPE REF TO data + RETURNING VALUE(rv_lines) TYPE i. + + METHODS value_of + IMPORTING ir_data TYPE REF TO data + iv_row TYPE i + iv_col TYPE string + RETURNING VALUE(rv_value) TYPE string. + + METHODS all_wards FOR TESTING. + METHODS sorted_by_cost FOR TESTING. + METHODS counts_and_bed_days FOR TESTING. + METHODS total_cost FOR TESTING. + METHODS open_stay_uses_p_to FOR TESTING. + METHODS ward_filter FOR TESTING. + METHODS date_filter FOR TESTING. + METHODS empty_result FOR TESTING. +ENDCLASS. + + +CLASS {{p}}ward_hidden IMPLEMENTATION. + + METHOD run. + cl_salv_bs_runtime_info=>set( display = abap_false + metadata = abap_false + data = abap_true ). + SUBMIT {{p}}ward_stay + WITH p_from = iv_from + WITH p_to = iv_to + WITH s_ward IN it_ward + AND RETURN. + TRY. + cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ). + CATCH cx_salv_bs_sc_runtime_info. + ENDTRY. + cl_salv_bs_runtime_info=>clear_all( ). + ENDMETHOD. + + METHOD lines_of. + FIELD-SYMBOLS TYPE STANDARD TABLE. + IF ir_data IS BOUND. + ASSIGN ir_data->* TO . + rv_lines = lines( ). + ENDIF. + ENDMETHOD. + + METHOD value_of. + FIELD-SYMBOLS TYPE STANDARD TABLE. + FIELD-SYMBOLS TYPE any. + FIELD-SYMBOLS TYPE any. + + ASSIGN ir_data->* TO . + READ TABLE ASSIGNING INDEX iv_row. + cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Row { iv_row } is missing| ). + ASSIGN COMPONENT iv_col OF STRUCTURE TO . + cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Column { iv_col } is missing| ). + rv_value = condense( CONV string( ) ). + ENDMETHOD. + + METHOD all_wards. + cl_abap_unit_assert=>assert_equals( + exp = 2 + act = lines_of( run( iv_from = '20260101' iv_to = '20260131' ) ) ). + ENDMETHOD. + + METHOD sorted_by_cost. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( + exp = `B` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `WARD` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `A` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `WARD` ) ). + ENDMETHOD. + + METHOD counts_and_bed_days. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( + exp = `2` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `ADMISSIONS` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `21` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `BED_DAYS` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `2` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `ADMISSIONS` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `5` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `BED_DAYS` ) ). + ENDMETHOD. + + METHOD total_cost. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( + exp = `5250.00` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TOTAL_COST` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `500.00` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `TOTAL_COST` ) ). + ENDMETHOD. + + METHOD open_stay_uses_p_to. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260125' ). + cl_abap_unit_assert=>assert_equals( + exp = `15` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `BED_DAYS` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `3750.00` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TOTAL_COST` ) ). + ENDMETHOD. + + METHOD ward_filter. + DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' + it_ward = VALUE #( ( sign = 'I' option = 'EQ' low = 'B' ) ) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( + exp = `B` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `WARD` ) ). + ENDMETHOD. + + METHOD date_filter. + DATA(lr_data) = run( iv_from = '20260201' iv_to = '20260228' ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ). + cl_abap_unit_assert=>assert_equals( + exp = `A` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `WARD` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `2` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `BED_DAYS` ) ). + cl_abap_unit_assert=>assert_equals( + exp = `200.00` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TOTAL_COST` ) ). + ENDMETHOD. + + METHOD empty_result. + cl_abap_unit_assert=>assert_equals( + exp = 0 + act = lines_of( run( iv_from = '20270101' iv_to = '20270131' ) ) ). + ENDMETHOD. + +ENDCLASS. diff --git a/tasks_gen/eval/G0161/hidden/zoo_hidden.clas.abap b/tasks_gen/eval/G0161/hidden/zoo_hidden.clas.abap deleted file mode 100644 index 9305b94..0000000 --- a/tasks_gen/eval/G0161/hidden/zoo_hidden.clas.abap +++ /dev/null @@ -1,125 +0,0 @@ -CLASS {{p}}zoo_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - METHODS all_enclosures FOR TESTING. - METHODS sort_by_cost FOR TESTING. - METHODS tie_break FOR TESTING. - METHODS weight_filter FOR TESTING. - METHODS weight_boundary FOR TESTING. - METHODS enclosure_filter FOR TESTING. -ENDCLASS. - -CLASS lcl_zoo_helper DEFINITION FINAL. - PUBLIC SECTION. - TYPES tt_enclosure TYPE RANGE OF {{p}}animal-enclosure. - CLASS-METHODS run - IMPORTING iv_minwg TYPE {{p}}animal-weight_kg - it_enclosure TYPE tt_enclosure OPTIONAL - RETURNING VALUE(rr_data) TYPE REF TO data. - CLASS-METHODS lines_of - IMPORTING ir_data TYPE REF TO data - RETURNING VALUE(rv_lines) TYPE i. - CLASS-METHODS value_of - IMPORTING ir_data TYPE REF TO data - iv_row TYPE i - iv_col TYPE string - RETURNING VALUE(rv_value) TYPE string. -ENDCLASS. - -CLASS lcl_zoo_helper IMPLEMENTATION. - METHOD run. - cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ). - SUBMIT {{p}}zoo_feed - WITH p_minwg = iv_minwg - WITH s_encl IN it_enclosure - AND RETURN. - TRY. - cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ). - CATCH cx_salv_bs_sc_runtime_info. - ENDTRY. - cl_salv_bs_runtime_info=>clear_all( ). - ENDMETHOD. - - METHOD lines_of. - FIELD-SYMBOLS TYPE STANDARD TABLE. - IF ir_data IS BOUND. - ASSIGN ir_data->* TO . - rv_lines = lines( ). - ENDIF. - ENDMETHOD. - - METHOD value_of. - FIELD-SYMBOLS TYPE STANDARD TABLE. - ASSIGN ir_data->* TO . - ASSIGN [ iv_row ] TO FIELD-SYMBOL(). - ASSIGN COMPONENT iv_col OF STRUCTURE TO FIELD-SYMBOL(). - cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Column { iv_col } missing| ). - rv_value = condense( CONV string( ) ). - ENDMETHOD. -ENDCLASS. - -CLASS {{p}}zoo_hidden IMPLEMENTATION. - METHOD all_enclosures. - cl_abap_unit_assert=>assert_equals( - exp = 3 - act = lcl_zoo_helper=>lines_of( lcl_zoo_helper=>run( iv_minwg = '0.0' ) ) ). - ENDMETHOD. - - METHOD sort_by_cost. - DATA(lr_data) = lcl_zoo_helper=>run( iv_minwg = '0.0' ). - cl_abap_unit_assert=>assert_equals( - exp = `JUNGLE` - act = lcl_zoo_helper=>value_of( ir_data = lr_data iv_row = 1 iv_col = `ENCLOSURE` ) ). - cl_abap_unit_assert=>assert_equals( - exp = `34.00` - act = lcl_zoo_helper=>value_of( ir_data = lr_data iv_row = 1 iv_col = `COST` ) ). - ENDMETHOD. - - METHOD tie_break. - DATA(lr_data) = lcl_zoo_helper=>run( iv_minwg = '0.0' ). - cl_abap_unit_assert=>assert_equals( - exp = `AQUA` - act = lcl_zoo_helper=>value_of( ir_data = lr_data iv_row = 2 iv_col = `ENCLOSURE` ) ). - cl_abap_unit_assert=>assert_equals( - exp = `SAVANNA` - act = lcl_zoo_helper=>value_of( ir_data = lr_data iv_row = 3 iv_col = `ENCLOSURE` ) ). - ENDMETHOD. - - METHOD weight_filter. - DATA(lr_data) = lcl_zoo_helper=>run( iv_minwg = '10.0' ). - cl_abap_unit_assert=>assert_equals( exp = 3 act = lcl_zoo_helper=>lines_of( lr_data ) ). - cl_abap_unit_assert=>assert_equals( - exp = `AQUA` - act = lcl_zoo_helper=>value_of( ir_data = lr_data iv_row = 3 iv_col = `ENCLOSURE` ) ). - cl_abap_unit_assert=>assert_equals( - exp = `1` - act = lcl_zoo_helper=>value_of( ir_data = lr_data iv_row = 3 iv_col = `ANIMALS` ) ). - cl_abap_unit_assert=>assert_equals( - exp = `15.00` - act = lcl_zoo_helper=>value_of( ir_data = lr_data iv_row = 3 iv_col = `COST` ) ). - ENDMETHOD. - - METHOD weight_boundary. - DATA(lr_low) = lcl_zoo_helper=>run( iv_minwg = '8.0' ). - cl_abap_unit_assert=>assert_equals( - exp = `3` - act = lcl_zoo_helper=>value_of( ir_data = lr_low iv_row = 1 iv_col = `ANIMALS` ) ). - DATA(lr_high) = lcl_zoo_helper=>run( iv_minwg = '9.0' ). - cl_abap_unit_assert=>assert_equals( - exp = `2` - act = lcl_zoo_helper=>value_of( ir_data = lr_high iv_row = 1 iv_col = `ANIMALS` ) ). - ENDMETHOD. - - METHOD enclosure_filter. - DATA(lr_data) = lcl_zoo_helper=>run( - iv_minwg = '0.0' - it_enclosure = VALUE #( ( sign = 'I' option = 'EQ' low = 'AQUA' ) ) ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lcl_zoo_helper=>lines_of( lr_data ) ). - cl_abap_unit_assert=>assert_equals( - exp = `20.00` - act = lcl_zoo_helper=>value_of( ir_data = lr_data iv_row = 1 iv_col = `COST` ) ). - cl_abap_unit_assert=>assert_equals( - exp = `2` - act = lcl_zoo_helper=>value_of( ir_data = lr_data iv_row = 1 iv_col = `ANIMALS` ) ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0161/mutation.json b/tasks_gen/eval/G0161/mutation.json new file mode 100644 index 0000000..ce01a72 --- /dev/null +++ b/tasks_gen/eval/G0161/mutation.json @@ -0,0 +1,71 @@ +{ + "task": "G0161", + "mutants": [ + { + "object": "{{P}}WARD_STAY", + "mutant": "line 55: <= -> > (rel)", + "status": "killed", + "hidden": "1/8", + "failed_tests": [ + "ALL_WARDS", + "COUNTS_AND_BED_DAYS", + "DATE_FILTER", + "OPEN_STAY_USES_P_TO", + "SORTED_BY_COST", + "TOTAL_COST", + "WARD_FILTER" + ] + }, + { + "object": "{{P}}WARD_STAY", + "mutant": "line 56: AND -> OR (logic)", + "status": "killed", + "hidden": "2/8", + "failed_tests": [ + "ALL_WARDS", + "COUNTS_AND_BED_DAYS", + "DATE_FILTER", + "EMPTY_RESULT", + "TOTAL_COST", + "WARD_FILTER" + ] + }, + { + "object": "{{P}}WARD_STAY", + "mutant": "line 100: + -> - (arith)", + "status": "killed", + "hidden": "7/8", + "failed_tests": [ + "COUNTS_AND_BED_DAYS" + ] + }, + { + "object": "{{P}}WARD_STAY", + "mutant": "line 101: + -> - (arith)", + "status": "killed", + "hidden": "5/8", + "failed_tests": [ + "COUNTS_AND_BED_DAYS", + "DATE_FILTER", + "OPEN_STAY_USES_P_TO" + ] + }, + { + "object": "{{P}}WARD_STAY", + "mutant": "line 102: + -> - (arith)", + "status": "killed", + "hidden": "3/8", + "failed_tests": [ + "COUNTS_AND_BED_DAYS", + "DATE_FILTER", + "OPEN_STAY_USES_P_TO", + "SORTED_BY_COST", + "TOTAL_COST" + ] + } + ], + "valid": 5, + "killed": 5, + "kill_rate": 1.0, + "ok": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0161/reference/ward_stay.prog.abap b/tasks_gen/eval/G0161/reference/ward_stay.prog.abap new file mode 100644 index 0000000..9bfdb0c --- /dev/null +++ b/tasks_gen/eval/G0161/reference/ward_stay.prog.abap @@ -0,0 +1,193 @@ +REPORT {{p}}ward_stay. + +TYPES ty_ward TYPE {{p}}admit-ward. + +DATA gv_ward TYPE ty_ward. + +PARAMETERS p_from TYPE d OBLIGATORY. +PARAMETERS p_to TYPE d OBLIGATORY. +SELECT-OPTIONS s_ward FOR gv_ward. + +CLASS lcl_report DEFINITION FINAL. + PUBLIC SECTION. + TYPES: + BEGIN OF ty_admit, + adm_id TYPE {{p}}admit-adm_id, + ward TYPE {{p}}admit-ward, + admit_date TYPE {{p}}admit-admit_date, + discharge_date TYPE {{p}}admit-discharge_date, + daily_rate TYPE {{p}}admit-daily_rate, + END OF ty_admit, + tt_admit TYPE STANDARD TABLE OF ty_admit WITH EMPTY KEY, + BEGIN OF ty_line, + ward TYPE {{p}}admit-ward, + admissions TYPE i, + bed_days TYPE i, + total_cost TYPE {{p}}admit-daily_rate, + END OF ty_line, + tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY, + tt_ward TYPE RANGE OF {{p}}admit-ward. + METHODS select_stays + IMPORTING iv_from TYPE d + iv_to TYPE d + it_ward TYPE tt_ward + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS aggregate + IMPORTING it_admit TYPE tt_admit + iv_to TYPE d + RETURNING VALUE(rt_lines) TYPE tt_line. + METHODS display + CHANGING ct_lines TYPE tt_line. + PRIVATE SECTION. + METHODS add_admission + IMPORTING is_admit TYPE ty_admit + iv_to TYPE d + CHANGING ct_lines TYPE tt_line. +ENDCLASS. + +CLASS lcl_report IMPLEMENTATION. + METHOD select_stays. + DATA lt_admit TYPE tt_admit. + + SELECT adm_id, ward, admit_date, discharge_date, daily_rate + FROM {{p}}admit + WHERE admit_date >= @iv_from + AND admit_date <= @iv_to + AND ward IN @it_ward + INTO TABLE @lt_admit. + + rt_lines = aggregate( it_admit = lt_admit + iv_to = iv_to ). + ENDMETHOD. + + METHOD aggregate. + DATA ls_admit TYPE ty_admit. + + LOOP AT it_admit INTO ls_admit. + add_admission( EXPORTING is_admit = ls_admit + iv_to = iv_to + CHANGING ct_lines = rt_lines ). + ENDLOOP. + + SORT rt_lines BY total_cost DESCENDING. + ENDMETHOD. + + METHOD add_admission. + DATA lv_discharge TYPE d. + DATA lv_days TYPE i. + DATA lv_cost TYPE {{p}}admit-daily_rate. + DATA lv_index TYPE i. + DATA ls_line TYPE ty_line. + + lv_discharge = is_admit-discharge_date. + IF lv_discharge IS INITIAL. + lv_discharge = iv_to. + ENDIF. + + lv_days = lv_discharge - is_admit-admit_date. + lv_cost = lv_days * is_admit-daily_rate. + + READ TABLE ct_lines INTO ls_line WITH KEY ward = is_admit-ward. + IF sy-subrc = 0. + lv_index = sy-tabix. + ELSE. + CLEAR ls_line. + ls_line-ward = is_admit-ward. + APPEND ls_line TO ct_lines. + lv_index = lines( ct_lines ). + ENDIF. + + ls_line-admissions = ls_line-admissions + 1. + ls_line-bed_days = ls_line-bed_days + lv_days. + ls_line-total_cost = ls_line-total_cost + lv_cost. + MODIFY ct_lines INDEX lv_index FROM ls_line. + ENDMETHOD. + + METHOD display. + DATA lo_alv TYPE REF TO cl_salv_table. + DATA lx_error TYPE REF TO cx_salv_msg. + + TRY. + cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv + CHANGING t_table = ct_lines ). + lo_alv->display( ). + CATCH cx_salv_msg INTO lx_error. + MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'. + ENDTRY. + ENDMETHOD. +ENDCLASS. + +START-OF-SELECTION. + DATA go_report TYPE REF TO lcl_report. + DATA gt_lines TYPE lcl_report=>tt_line. + + go_report = NEW lcl_report( ). + gt_lines = go_report->select_stays( iv_from = p_from + iv_to = p_to + it_ward = s_ward[] ). + go_report->display( CHANGING ct_lines = gt_lines ). + +CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS open_stay_uses_p_to FOR TESTING. + METHODS totals_per_ward FOR TESTING. + METHODS sorted_by_cost FOR TESTING. +ENDCLASS. + +CLASS ltc_report IMPLEMENTATION. + METHOD open_stay_uses_p_to. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '00000000' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260105' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_line-bed_days ). + cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}admit-daily_rate( 40 ) + act = ls_line-total_cost ). + ENDMETHOD. + + METHOD totals_per_ward. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'A' admit_date = '20260105' + discharge_date = '20260106' daily_rate = '10.00' ) + ( adm_id = 3 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '5.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). + + READ TABLE lt_lines INTO ls_line WITH KEY ward = 'A'. + cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-admissions ). + cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_line-bed_days ). + ENDMETHOD. + + METHOD sorted_by_cost. + DATA lt_admit TYPE lcl_report=>tt_admit. + DATA lt_lines TYPE lcl_report=>tt_line. + DATA ls_line TYPE lcl_report=>ty_line. + + lt_admit = VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260101' + discharge_date = '20260103' daily_rate = '10.00' ) + ( adm_id = 2 ward = 'B' admit_date = '20260101' + discharge_date = '20260111' daily_rate = '10.00' ) ). + + lt_lines = NEW lcl_report( )->aggregate( it_admit = lt_admit + iv_to = '20260131' ). + READ TABLE lt_lines INTO ls_line INDEX 1. + cl_abap_unit_assert=>assert_equals( exp = 'B' act = ls_line-ward ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0161/reference/zoo_feed.prog.abap b/tasks_gen/eval/G0161/reference/zoo_feed.prog.abap deleted file mode 100644 index 025b743..0000000 --- a/tasks_gen/eval/G0161/reference/zoo_feed.prog.abap +++ /dev/null @@ -1,160 +0,0 @@ -REPORT {{p}}zoo_feed. - -TYPES: BEGIN OF ty_line, - enclosure TYPE {{p}}animal-enclosure, - animals TYPE i, - cost TYPE {{p}}animal-food_cost, - END OF ty_line. -TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY. -TYPES tt_enclosure TYPE RANGE OF {{p}}animal-enclosure. - -TYPES: BEGIN OF ty_animal, - enclosure TYPE {{p}}animal-enclosure, - food_cost TYPE {{p}}animal-food_cost, - END OF ty_animal. -TYPES tt_animal TYPE STANDARD TABLE OF ty_animal WITH EMPTY KEY. - -DATA gv_enclosure TYPE {{p}}animal-enclosure. - -PARAMETERS p_minwg TYPE {{p}}animal-weight_kg OBLIGATORY. -SELECT-OPTIONS s_encl FOR gv_enclosure. - -CLASS lcl_report DEFINITION FINAL. - PUBLIC SECTION. - CLASS-METHODS select_lines - IMPORTING iv_min_weight TYPE {{p}}animal-weight_kg - it_enclosure TYPE tt_enclosure - RETURNING VALUE(rt_lines) TYPE tt_line. - CLASS-METHODS display - CHANGING ct_lines TYPE tt_line. -ENDCLASS. - -CLASS lcl_report IMPLEMENTATION. - METHOD select_lines. - DATA: lt_animals TYPE tt_animal, - ls_animal TYPE ty_animal, - ls_line TYPE ty_line. - - SELECT enclosure food_cost - FROM {{p}}animal - INTO CORRESPONDING FIELDS OF TABLE lt_animals - WHERE weight_kg >= iv_min_weight - AND enclosure IN it_enclosure. - - LOOP AT lt_animals INTO ls_animal. - READ TABLE rt_lines INTO ls_line - WITH KEY enclosure = ls_animal-enclosure. - IF sy-subrc = 0. - ls_line-animals = ls_line-animals + 1. - ls_line-cost = ls_line-cost + ls_animal-food_cost. - MODIFY rt_lines FROM ls_line INDEX sy-tabix. - ELSE. - CLEAR ls_line. - ls_line-enclosure = ls_animal-enclosure. - ls_line-animals = 1. - ls_line-cost = ls_animal-food_cost. - APPEND ls_line TO rt_lines. - ENDIF. - ENDLOOP. - - SORT rt_lines BY cost DESCENDING enclosure ASCENDING. - ENDMETHOD. - - METHOD display. - DATA: lo_alv TYPE REF TO cl_salv_table, - lx_msg TYPE REF TO cx_salv_msg. - TRY. - cl_salv_table=>factory( - IMPORTING r_salv_table = lo_alv - CHANGING t_table = ct_lines ). - lo_alv->display( ). - CATCH cx_salv_msg INTO lx_msg. - MESSAGE lx_msg TYPE 'I' DISPLAY LIKE 'E'. - ENDTRY. - ENDMETHOD. -ENDCLASS. - -START-OF-SELECTION. - DATA gt_lines TYPE tt_line. - - gt_lines = lcl_report=>select_lines( iv_min_weight = p_minwg - it_enclosure = s_encl[] ). - lcl_report=>display( CHANGING ct_lines = gt_lines ). - -CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - CLASS-DATA go_env TYPE REF TO if_osql_test_environment. - CLASS-METHODS class_setup. - CLASS-METHODS class_teardown. - METHODS totals_per_enclosure FOR TESTING. - METHODS weight_filter FOR TESTING. -ENDCLASS. - -CLASS ltc_report IMPLEMENTATION. - METHOD class_setup. - go_env = cl_osql_test_environment=>create( - i_dependency_list = VALUE #( ( '{{P}}ANIMAL' ) ) ). - DATA: lt_animal TYPE STANDARD TABLE OF {{p}}animal WITH EMPTY KEY, - ls_animal TYPE {{p}}animal. - - ls_animal-animal_id = 1. - ls_animal-enclosure = 'A'. - ls_animal-species = 'LION'. - ls_animal-weight_kg = '100.0'. - ls_animal-food_cost = '10.00'. - APPEND ls_animal TO lt_animal. - - CLEAR ls_animal. - ls_animal-animal_id = 2. - ls_animal-enclosure = 'A'. - ls_animal-species = 'CUB'. - ls_animal-weight_kg = '5.0'. - ls_animal-food_cost = '2.00'. - APPEND ls_animal TO lt_animal. - - CLEAR ls_animal. - ls_animal-animal_id = 3. - ls_animal-enclosure = 'B'. - ls_animal-species = 'SEAL'. - ls_animal-weight_kg = '50.0'. - ls_animal-food_cost = '7.00'. - APPEND ls_animal TO lt_animal. - - go_env->insert_test_data( lt_animal ). - ENDMETHOD. - - METHOD class_teardown. - go_env->destroy( ). - ENDMETHOD. - - METHOD totals_per_enclosure. - DATA: lt_lines TYPE tt_line, - ls_line TYPE ty_line, - lt_none TYPE tt_enclosure. - - lt_lines = lcl_report=>select_lines( iv_min_weight = '0.0' - it_enclosure = lt_none ). - - cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). - - READ TABLE lt_lines INTO ls_line INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 'A' act = ls_line-enclosure ). - cl_abap_unit_assert=>assert_equals( - exp = CONV {{p}}animal-food_cost( 12 ) act = ls_line-cost ). - cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_line-animals ). - ENDMETHOD. - - METHOD weight_filter. - DATA: lt_lines TYPE tt_line, - ls_line TYPE ty_line, - lt_none TYPE tt_enclosure. - - lt_lines = lcl_report=>select_lines( iv_min_weight = '10.0' - it_enclosure = lt_none ). - - cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ). - - READ TABLE lt_lines INTO ls_line INDEX 1. - cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_line-animals ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0161/seed/admit.tabl.asabap b/tasks_gen/eval/G0161/seed/admit.tabl.asabap new file mode 100644 index 0000000..0dcf67a --- /dev/null +++ b/tasks_gen/eval/G0161/seed/admit.tabl.asabap @@ -0,0 +1,13 @@ +@EndUserText.label : 'Hospital admissions' +@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE +@AbapCatalog.tableCategory : #TRANSPARENT +@AbapCatalog.deliveryClass : #A +@AbapCatalog.dataMaintenance : #RESTRICTED +define table {{p}}admit { + key client : abap.clnt not null; + key adm_id : abap.int4 not null; + ward : abap.char(4); + admit_date : abap.dats; + discharge_date : abap.dats; + daily_rate : abap.dec(15,2); +} diff --git a/tasks_gen/eval/G0161/seed/admit_seed.clas.abap b/tasks_gen/eval/G0161/seed/admit_seed.clas.abap new file mode 100644 index 0000000..e18df69 --- /dev/null +++ b/tasks_gen/eval/G0161/seed/admit_seed.clas.abap @@ -0,0 +1,18 @@ +CLASS {{p}}admit_seed DEFINITION PUBLIC FINAL CREATE PUBLIC. + PUBLIC SECTION. + INTERFACES if_oo_adt_classrun. +ENDCLASS. + +CLASS {{p}}admit_seed IMPLEMENTATION. + METHOD if_oo_adt_classrun~main. + DELETE FROM {{p}}admit. + INSERT {{p}}admit FROM TABLE @( VALUE #( + ( adm_id = 1 ward = 'A' admit_date = '20260105' discharge_date = '20260109' daily_rate = '100.00' ) + ( adm_id = 2 ward = 'A' admit_date = '20260110' discharge_date = '20260111' daily_rate = '100.00' ) + ( adm_id = 3 ward = 'B' admit_date = '20260106' discharge_date = '20260116' daily_rate = '250.00' ) + ( adm_id = 4 ward = 'B' admit_date = '20260120' discharge_date = '00000000' daily_rate = '250.00' ) + ( adm_id = 5 ward = 'C' admit_date = '20251220' discharge_date = '20251225' daily_rate = '50.00' ) + ( adm_id = 6 ward = 'A' admit_date = '20260201' discharge_date = '20260203' daily_rate = '100.00' ) ) ). + out->write( sy-dbcnt ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0161/seed/animal.tabl.asabap b/tasks_gen/eval/G0161/seed/animal.tabl.asabap deleted file mode 100644 index ef1a2d9..0000000 --- a/tasks_gen/eval/G0161/seed/animal.tabl.asabap +++ /dev/null @@ -1,13 +0,0 @@ -@EndUserText.label : 'Zoo animals' -@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE -@AbapCatalog.tableCategory : #TRANSPARENT -@AbapCatalog.deliveryClass : #A -@AbapCatalog.dataMaintenance : #RESTRICTED -define table {{p}}animal { - key client : abap.clnt not null; - key animal_id : abap.int4 not null; - enclosure : abap.char(10); - species : abap.char(20); - weight_kg : abap.dec(5,1); - food_cost : abap.dec(9,2); -} diff --git a/tasks_gen/eval/G0161/seed/zoo_seed.clas.abap b/tasks_gen/eval/G0161/seed/zoo_seed.clas.abap deleted file mode 100644 index 489811c..0000000 --- a/tasks_gen/eval/G0161/seed/zoo_seed.clas.abap +++ /dev/null @@ -1,19 +0,0 @@ -CLASS {{p}}zoo_seed DEFINITION PUBLIC FINAL CREATE PUBLIC. - PUBLIC SECTION. - INTERFACES if_oo_adt_classrun. -ENDCLASS. - -CLASS {{p}}zoo_seed IMPLEMENTATION. - METHOD if_oo_adt_classrun~main. - DELETE FROM {{p}}animal. - INSERT {{p}}animal FROM TABLE @( VALUE #( - ( animal_id = 1 enclosure = 'SAVANNA' species = 'GIRAFFE' weight_kg = '800.0' food_cost = '12.50' ) - ( animal_id = 2 enclosure = 'SAVANNA' species = 'ZEBRA' weight_kg = '250.0' food_cost = '7.50' ) - ( animal_id = 3 enclosure = 'AQUA' species = 'SEAL' weight_kg = '120.0' food_cost = '15.00' ) - ( animal_id = 4 enclosure = 'AQUA' species = 'OTTER' weight_kg = '6.0' food_cost = '5.00' ) - ( animal_id = 5 enclosure = 'JUNGLE' species = 'TIGER' weight_kg = '200.0' food_cost = '15.00' ) - ( animal_id = 6 enclosure = 'JUNGLE' species = 'BEAR' weight_kg = '300.0' food_cost = '15.00' ) - ( animal_id = 7 enclosure = 'JUNGLE' species = 'MONKEY' weight_kg = '8.0' food_cost = '4.00' ) ) ). - out->write( sy-dbcnt ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0161/spec.md b/tasks_gen/eval/G0161/spec.md index b31556b..535f43a 100644 --- a/tasks_gen/eval/G0161/spec.md +++ b/tasks_gen/eval/G0161/spec.md @@ -1,41 +1,63 @@ # 1. Goal -Show the daily food cost of each enclosure in the zoo in an ALV list. The zoo -keeper uses the list to plan the daily food order. + +A hospital wants a report about the bed days of its wards. The report shows, +for each ward, the number of admissions in a period, the bed days, and the cost +of these bed days. The hospital management compares the wards with this report. # 2. Open questions + None. # 3. Context -- The table {{P}}ANIMAL exists in package $TMP and contains data. - Fields: ANIMAL_ID (INT4, key), ENCLOSURE (CHAR 10), SPECIES (CHAR 20), - WEIGHT_KG (DEC 5,1), FOOD_COST (DEC 9,2). -- FOOD_COST is the daily food cost of one animal in euro. + +- The table {{P}}ADMIT exists in package $TMP. The table contains data. The + fields are: + - ADM_ID: INT4, key. The admission ID. + - WARD: CHAR 4. The ward. + - ADMIT_DATE: DATS. The admission date. + - DISCHARGE_DATE: DATS. The discharge date. The field is initial while the + patient is still in the ward. + - DAILY_RATE: DEC 15,2. The cost of one bed day in this ward. # 4. Contract -- Create the executable program {{P}}ZOO_FEED in package $TMP. + +- Create the executable program {{P}}WARD_STAY in package $TMP. - Selection screen: - - Parameter P_MINWG, type {{P}}ANIMAL-WEIGHT_KG, mandatory: the smallest - weight of an animal to include. - - Select-option S_ENCL for the enclosure. -- Show the result with CL_SALV_TABLE. The output table has these columns with - these names: ENCLOSURE, ANIMALS, COST. + - Parameter P_FROM, type DATS, mandatory. The first admission date to include. + - Parameter P_TO, type DATS, mandatory. The last admission date to include. + - Select-option S_WARD for the ward. +- Show the result with CL_SALV_TABLE. The output table has exactly these columns + with these names and types: + - WARD: type {{P}}ADMIT-WARD. + - ADMISSIONS: type I. + - BED_DAYS: type I. + - TOTAL_COST: type {{P}}ADMIT-DAILY_RATE. # 5. Business rules -1. Include an animal only if WEIGHT_KG is greater than or equal to P_MINWG and - ENCLOSURE is in S_ENCL. -2. Show one line for each enclosure that has at least one included animal. -3. ANIMALS is the number of included animals of the enclosure. -4. COST is the sum of FOOD_COST of the included animals of the enclosure. -5. Sort the lines by COST, the highest cost first. -6. If two lines have the same COST, sort them by ENCLOSURE in ascending order. + +1. Include an admission only if ADMIT_DATE is on or after P_FROM, ADMIT_DATE is + on or before P_TO, and WARD is in S_WARD. +2. The bed days of one admission are DISCHARGE_DATE minus ADMIT_DATE. +3. If DISCHARGE_DATE of an admission is initial, use P_TO as the discharge date + of this admission. +4. The cost of one admission is the bed days of the admission multiplied by + DAILY_RATE. +5. Show one line for each ward that has at least one included admission. +6. ADMISSIONS is the number of included admissions of the ward. +7. BED_DAYS is the sum of the bed days of the included admissions of the ward. +8. TOTAL_COST is the sum of the costs of the included admissions of the ward. +9. Sort the lines by TOTAL_COST, the highest total first. # 6. Constraints -- Release target: 7.40 SP05. Use only ABAP syntax that is available in this - release. Do not use syntax of a newer release. -- Coding standards: Clean ABAP. Read the data with one database access. -- Out of scope: do not change {{P}}ANIMAL. + +- Release target: 7.40 SP05. Do not use ABAP syntax that is newer than + 7.40 SP05. Examples of newer syntax are table expressions, FOR or REDUCE in + constructor expressions, string aggregation, UNION, and WITH. +- Coding standards: Clean ABAP. Read the admissions with one database access. +- Out of scope: do not change the table {{P}}ADMIT. # 7. Acceptance + - The program is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests as local test classes in the program. diff --git a/tasks_gen/eval/G0161/task.json b/tasks_gen/eval/G0161/task.json index bb05b47..1941bd7 100644 --- a/tasks_gen/eval/G0161/task.json +++ b/tasks_gen/eval/G0161/task.json @@ -6,56 +6,56 @@ "release_target": "v740sp05", "expected_outcome": "implement", "budget": { - "max_tool_calls": 40, - "max_activations": 10 + "max_tool_calls": 60, + "max_activations": 15 }, "seed": [ { "type": "TABL", - "name": "{{P}}ANIMAL", - "file": "seed/animal.tabl.asabap", - "description": "Zoo animals" + "name": "{{P}}ADMIT", + "file": "seed/admit.tabl.asabap", + "description": "Hospital admissions" }, { "type": "CLAS", - "name": "{{P}}ZOO_SEED", - "file": "seed/zoo_seed.clas.abap", - "description": "Zoo seed data", + "name": "{{P}}ADMIT_SEED", + "file": "seed/admit_seed.clas.abap", + "description": "Admission seed data", "run": true } ], "contract": [ { "type": "PROG", - "name": "{{P}}ZOO_FEED", + "name": "{{P}}WARD_STAY", "parameters": [ - "p_minwg", - "s_encl" + "p_from", + "p_to", + "s_ward" ] } ], "out_of_scope": [ - "{{P}}ANIMAL" + "{{P}}ADMIT" ], "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}ZOO_HIDDEN", - "file": "hidden/zoo_hidden.clas.abap", - "description": "Zoo feed hidden tests" + "name": "{{P}}WARD_HIDDEN", + "file": "hidden/ward_hidden.clas.abap", + "description": "Ward bed days and cost hidden tests" } ], "reference": [ { "type": "PROG", - "name": "{{P}}ZOO_FEED", - "file": "reference/zoo_feed.prog.abap", - "description": "Daily food cost per enclosure" + "name": "{{P}}WARD_STAY", + "file": "reference/ward_stay.prog.abap", + "description": "Bed days and cost per ward" } ], "craft_checks": [ "db_operation_in_loop", - "method_length", - "no_newer_syntax" + "method_length" ] } \ No newline at end of file diff --git a/tasks_gen/eval/G0162/empirical.json b/tasks_gen/eval/G0162/empirical.json new file mode 100644 index 0000000..c04a82a --- /dev/null +++ b/tasks_gen/eval/G0162/empirical.json @@ -0,0 +1,17 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "failed_gates": [ + "G1_active", + "G2_contract", + "G3_hidden_runs" + ] + }, + "hidden": "0/0", + "tool_calls": 40, + "seconds": 259.5, + "run_dir": "runs/emp/12025_G0162_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0162/review.json b/tasks_gen/eval/G0162/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0162/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0163/empirical.json b/tasks_gen/eval/G0163/empirical.json new file mode 100644 index 0000000..24ec9df --- /dev/null +++ b/tasks_gen/eval/G0163/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 17, + "seconds": 397.6, + "run_dir": "runs/emp/12024_G0163_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0163/review.json b/tasks_gen/eval/G0163/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0163/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0164/empirical.json b/tasks_gen/eval/G0164/empirical.json new file mode 100644 index 0000000..f70e441 --- /dev/null +++ b/tasks_gen/eval/G0164/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 75.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 0.0, + "total": 75.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "12/12", + "tool_calls": 13, + "seconds": 1043.6, + "run_dir": "runs/emp/12023_G0164_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0164/review.json b/tasks_gen/eval/G0164/review.json new file mode 100644 index 0000000..ebc3eea --- /dev/null +++ b/tasks_gen/eval/G0164/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Survived mutant: round dec +1, equivalent (result field has fewer decimals).", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0165/empirical.json b/tasks_gen/eval/G0165/empirical.json new file mode 100644 index 0000000..b8cc975 --- /dev/null +++ b/tasks_gen/eval/G0165/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 85.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 10.0, + "total": 85.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "6/6", + "tool_calls": 24, + "seconds": 112.4, + "run_dir": "runs/emp/12022_G0165_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0165/review.json b/tasks_gen/eval/G0165/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0165/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0166/empirical.json b/tasks_gen/eval/G0166/empirical.json new file mode 100644 index 0000000..5eb52d8 --- /dev/null +++ b/tasks_gen/eval/G0166/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 80.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 0.0, + "discipline": 5.0, + "total": 80.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "8/8", + "tool_calls": 26, + "seconds": 646.5, + "run_dir": "runs/emp/12021_G0166_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0166/review.json b/tasks_gen/eval/G0166/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0166/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0167/empirical.json b/tasks_gen/eval/G0167/empirical.json new file mode 100644 index 0000000..035e198 --- /dev/null +++ b/tasks_gen/eval/G0167/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "11/11", + "tool_calls": 9, + "seconds": 30.3, + "run_dir": "runs/emp/12020_G0167_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0167/review.json b/tasks_gen/eval/G0167/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0167/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0168/empirical.json b/tasks_gen/eval/G0168/empirical.json new file mode 100644 index 0000000..4f9ebc9 --- /dev/null +++ b/tasks_gen/eval/G0168/empirical.json @@ -0,0 +1,26 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100, + "parts": { + "total": 100, + "stop": "stopped", + "gap": { + "how": "keywords", + "group": [ + [ + "quantity", + "100" + ], + [ + "volume", + "discount" + ] + ] + } + }, + "hidden": "0/0", + "tool_calls": 7, + "seconds": 16.9, + "run_dir": "runs/emp/10053_G0168_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0169/empirical.json b/tasks_gen/eval/G0169/empirical.json new file mode 100644 index 0000000..5a4895c --- /dev/null +++ b/tasks_gen/eval/G0169/empirical.json @@ -0,0 +1,16 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 30, + "parts": { + "total": 30, + "stop": "stopped", + "gap": { + "how": "empty report" + } + }, + "hidden": "0/0", + "tool_calls": 0, + "seconds": 629.3, + "run_dir": "runs/emp/12019_G0169_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0169/review.json b/tasks_gen/eval/G0169/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0169/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0170/empirical.json b/tasks_gen/eval/G0170/empirical.json new file mode 100644 index 0000000..fcec2a7 --- /dev/null +++ b/tasks_gen/eval/G0170/empirical.json @@ -0,0 +1,16 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "stop": "implemented", + "objects": [ + "Z099U04Q_STUDIO_PRICER" + ] + }, + "hidden": "0/0", + "tool_calls": 9, + "seconds": 73.6, + "run_dir": "runs/emp/12018_G0170_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0170/review.json b/tasks_gen/eval/G0170/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0170/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0171/empirical.json b/tasks_gen/eval/G0171/empirical.json new file mode 100644 index 0000000..aa6535a --- /dev/null +++ b/tasks_gen/eval/G0171/empirical.json @@ -0,0 +1,19 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100, + "parts": { + "total": 100, + "stop": "stopped", + "gap": { + "how": "judge", + "model": "deepseek-v4.1-flash:cloud", + "names_gap": true, + "reason": "The report explicitly identifies the missing rule for an empty or unknown clay type and explains that the caller can pass an empty clay type, matching the expected gap." + } + }, + "hidden": "0/0", + "tool_calls": 2, + "seconds": 140.7, + "run_dir": "runs/emp/12017_G0171_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0171/review.json b/tasks_gen/eval/G0171/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0171/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0172/empirical.json b/tasks_gen/eval/G0172/empirical.json new file mode 100644 index 0000000..715b133 --- /dev/null +++ b/tasks_gen/eval/G0172/empirical.json @@ -0,0 +1,17 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "stop": "implemented", + "objects": [ + "Z099S04S_PROBE", + "Z099S04S_SORT_BIN" + ] + }, + "hidden": "0/0", + "tool_calls": 25, + "seconds": 83.6, + "run_dir": "runs/emp/12016_G0172_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0172/review.json b/tasks_gen/eval/G0172/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0172/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0173/empirical.json b/tasks_gen/eval/G0173/empirical.json new file mode 100644 index 0000000..c61c363 --- /dev/null +++ b/tasks_gen/eval/G0173/empirical.json @@ -0,0 +1,30 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100, + "parts": { + "total": 100, + "stop": "stopped", + "gap": { + "how": "keywords", + "group": [ + [ + "18", + "15" + ], + [ + "minimum", + "20" + ], + [ + "contradict", + "rule" + ] + ] + } + }, + "hidden": "0/0", + "tool_calls": 9, + "seconds": 66.6, + "run_dir": "runs/emp/12015_G0173_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0173/review.json b/tasks_gen/eval/G0173/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0173/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0174/empirical.json b/tasks_gen/eval/G0174/empirical.json new file mode 100644 index 0000000..6c37181 --- /dev/null +++ b/tasks_gen/eval/G0174/empirical.json @@ -0,0 +1,16 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "stop": "implemented", + "objects": [ + "Z099Q04U_FLOWER_SALES" + ] + }, + "hidden": "0/0", + "tool_calls": 12, + "seconds": 665.1, + "run_dir": "runs/emp/12014_G0174_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0174/review.json b/tasks_gen/eval/G0174/review.json new file mode 100644 index 0000000..2839909 --- /dev/null +++ b/tasks_gen/eval/G0174/review.json @@ -0,0 +1,9 @@ +{ + "decision": "flag", + "note": "Gap is only the missing sort direction of TOTAL_REVENUE. A model can guess 'highest first'; is it critical enough for a stop task?", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": { + "9": "zayif" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0175/empirical.json b/tasks_gen/eval/G0175/empirical.json new file mode 100644 index 0000000..0e8872e --- /dev/null +++ b/tasks_gen/eval/G0175/empirical.json @@ -0,0 +1,19 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100, + "parts": { + "total": 100, + "stop": "stopped", + "gap": { + "how": "judge", + "model": "deepseek-v4.1-flash:cloud", + "names_gap": true, + "reason": "The report explicitly identifies the contradiction between rule 1 requiring HARVEST_DATE >= P_FROM and rule 5 requiring HARVEST_DATE < P_FROM, making both conditions unsatisfiable together." + } + }, + "hidden": "0/0", + "tool_calls": 1, + "seconds": 7.9, + "run_dir": "runs/emp/12013_G0175_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0175/review.json b/tasks_gen/eval/G0175/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0175/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0176/empirical.json b/tasks_gen/eval/G0176/empirical.json new file mode 100644 index 0000000..e9dab75 --- /dev/null +++ b/tasks_gen/eval/G0176/empirical.json @@ -0,0 +1,16 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 0, + "parts": { + "total": 0, + "stop": "implemented", + "objects": [ + "Z099O04W_I_STATION_ENERGY" + ] + }, + "hidden": "0/0", + "tool_calls": 14, + "seconds": 534.6, + "run_dir": "runs/emp/12012_G0176_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0176/review.json b/tasks_gen/eval/G0176/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0176/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0177/empirical.json b/tasks_gen/eval/G0177/empirical.json new file mode 100644 index 0000000..bc912e5 --- /dev/null +++ b/tasks_gen/eval/G0177/empirical.json @@ -0,0 +1,30 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100, + "parts": { + "total": 100, + "stop": "stopped", + "gap": { + "how": "keywords", + "group": [ + [ + "contradiction", + "rules" + ], + [ + "contradict", + "rules" + ], + [ + "confirmed", + "cancelled" + ] + ] + } + }, + "hidden": "0/0", + "tool_calls": 6, + "seconds": 12.0, + "run_dir": "runs/emp/12011_G0177_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0177/review.json b/tasks_gen/eval/G0177/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0177/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0178/empirical.json b/tasks_gen/eval/G0178/empirical.json new file mode 100644 index 0000000..95fd1c6 --- /dev/null +++ b/tasks_gen/eval/G0178/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 98.5, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 13.5, + "own_tests": 15.0, + "discipline": 10.0, + "total": 98.5, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 11, + "seconds": 75.1, + "run_dir": "runs/emp/10054_G0178_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0179/empirical.json b/tasks_gen/eval/G0179/empirical.json index 838c6fb..bd7b4e0 100644 --- a/tasks_gen/eval/G0179/empirical.json +++ b/tasks_gen/eval/G0179/empirical.json @@ -12,7 +12,7 @@ }, "hidden": "10/10", "tool_calls": 6, - "seconds": 23.4, - "run_dir": "runs/emp/10003_G0007_llm_deepseek-v4.1-flash_cloud" + "seconds": 17.2, + "run_dir": "runs/emp/12010_G0179_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0179/review.json b/tasks_gen/eval/G0179/review.json index 8d4354a..d24ee23 100644 --- a/tasks_gen/eval/G0179/review.json +++ b/tasks_gen/eval/G0179/review.json @@ -1,6 +1,6 @@ { "decision": "accept", - "note": "Interface must be read; fits F.", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", "by": "Claude", "date": "2026-10-03", "failed_checks": {} diff --git a/tasks_gen/eval/G0180/empirical.json b/tasks_gen/eval/G0180/empirical.json index e7bce4e..83db395 100644 --- a/tasks_gen/eval/G0180/empirical.json +++ b/tasks_gen/eval/G0180/empirical.json @@ -1,18 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 80.0, + "score": 85.0, "parts": { "correctness": 40.0, "craft": 20.0, "clean": 15.0, "own_tests": 0.0, - "discipline": 5.0, - "total": 80.0, + "discipline": 10.0, + "total": 85.0, "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "10/10", - "tool_calls": 12, - "seconds": 656.4, - "run_dir": "runs/emp/10017_G0026_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 27, + "seconds": 140.5, + "run_dir": "runs/emp/12009_G0180_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0180/review.json b/tasks_gen/eval/G0180/review.json index 6290122..d24ee23 100644 --- a/tasks_gen/eval/G0180/review.json +++ b/tasks_gen/eval/G0180/review.json @@ -1,6 +1,6 @@ { "decision": "accept", - "note": "All rules tested; logic in helper class; mutation 5/5.", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", "by": "Claude", "date": "2026-10-03", "failed_checks": {} diff --git a/tasks_gen/eval/G0181/empirical.json b/tasks_gen/eval/G0181/empirical.json index a774b41..e540753 100644 --- a/tasks_gen/eval/G0181/empirical.json +++ b/tasks_gen/eval/G0181/empirical.json @@ -4,14 +4,12 @@ "parts": { "total": 0, "failed_gates": [ - "G1_active", - "G2_contract", "G3_hidden_runs" ] }, "hidden": "0/0", - "tool_calls": 36, - "seconds": 928.5, - "run_dir": "runs/emp/10007_G0014_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 16, + "seconds": 55.8, + "run_dir": "runs/emp/12008_G0181_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0181/review.json b/tasks_gen/eval/G0181/review.json index fba07a9..d24ee23 100644 --- a/tasks_gen/eval/G0181/review.json +++ b/tasks_gen/eval/G0181/review.json @@ -1,6 +1,6 @@ { "decision": "accept", - "note": "Sorted values distinct in data (120, 70, -20). Sort ties not defined in spec, but no tie in tests.", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", "by": "Claude", "date": "2026-10-03", "failed_checks": {} diff --git a/tasks_gen/eval/G0182/empirical.json b/tasks_gen/eval/G0182/empirical.json index c3d4bf2..3524470 100644 --- a/tasks_gen/eval/G0182/empirical.json +++ b/tasks_gen/eval/G0182/empirical.json @@ -1,18 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 77.0, + "score": 95.0, "parts": { "correctness": 40.0, "craft": 20.0, - "clean": 12.0, - "own_tests": 0.0, + "clean": 15.0, + "own_tests": 15.0, "discipline": 5.0, - "total": 77.0, + "total": 95.0, "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "8/8", - "tool_calls": 40, - "seconds": 164.6, - "run_dir": "runs/emp/10009_G0017_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 31, + "seconds": 114.9, + "run_dir": "runs/emp/12007_G0182_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0182/review.json b/tasks_gen/eval/G0182/review.json index 16d9ba3..d24ee23 100644 --- a/tasks_gen/eval/G0182/review.json +++ b/tasks_gen/eval/G0182/review.json @@ -1,6 +1,6 @@ { "decision": "accept", - "note": "Survived inner->left outer join is equivalent (WHERE on the right table).", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", "by": "Claude", "date": "2026-10-03", "failed_checks": {} diff --git a/tasks_gen/eval/G0183/empirical.json b/tasks_gen/eval/G0183/empirical.json index 1f08860..b6587c5 100644 --- a/tasks_gen/eval/G0183/empirical.json +++ b/tasks_gen/eval/G0183/empirical.json @@ -11,8 +11,8 @@ "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "8/8", - "tool_calls": 40, - "seconds": 174.6, - "run_dir": "runs/emp/10012_G0020_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 60, + "seconds": 162.4, + "run_dir": "runs/emp/12006_G0183_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0183/review.json b/tasks_gen/eval/G0183/review.json index 8fe504b..d24ee23 100644 --- a/tasks_gen/eval/G0183/review.json +++ b/tasks_gen/eval/G0183/review.json @@ -1,6 +1,6 @@ { "decision": "accept", - "note": "Survived join mutant is equivalent (WHERE on the right table).", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", "by": "Claude", "date": "2026-10-03", "failed_checks": {} diff --git a/tasks_gen/eval/G0184/empirical.json b/tasks_gen/eval/G0184/empirical.json index f5ccaa6..7ac9621 100644 --- a/tasks_gen/eval/G0184/empirical.json +++ b/tasks_gen/eval/G0184/empirical.json @@ -1,18 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 95.0, + "score": 98.5, "parts": { "correctness": 40.0, "craft": 20.0, - "clean": 15.0, + "clean": 13.5, "own_tests": 15.0, - "discipline": 5.0, - "total": 95.0, + "discipline": 10.0, + "total": 98.5, "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "13/13", - "tool_calls": 32, - "seconds": 141.5, - "run_dir": "runs/emp/10014_G0022_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 26, + "seconds": 94.6, + "run_dir": "runs/emp/12005_G0184_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0184/review.json b/tasks_gen/eval/G0184/review.json index b5f763a..d24ee23 100644 --- a/tasks_gen/eval/G0184/review.json +++ b/tasks_gen/eval/G0184/review.json @@ -1,6 +1,6 @@ { "decision": "accept", - "note": "Fixed: added other_currencies_pass; oracle 100, null 0, mutation 5/5.", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", "by": "Claude", "date": "2026-10-03", "failed_checks": {} diff --git a/tasks_gen/eval/G0185/empirical.json b/tasks_gen/eval/G0185/empirical.json index 8dd68cc..e107434 100644 --- a/tasks_gen/eval/G0185/empirical.json +++ b/tasks_gen/eval/G0185/empirical.json @@ -1,18 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 85.0, + "score": 50.9, "parts": { - "correctness": 40.0, + "correctness": 10.9, "craft": 20.0, "clean": 15.0, "own_tests": 0.0, - "discipline": 10.0, - "total": 85.0, + "discipline": 5.0, + "total": 50.9, "note": "own_tests: faulty-reference part not implemented in skeleton" }, - "hidden": "11/11", + "hidden": "3/11", "tool_calls": 17, - "seconds": 60.2, - "run_dir": "runs/emp/10006_G0012_llm_deepseek-v4.1-flash_cloud" + "seconds": 589.5, + "run_dir": "runs/emp/12004_G0185_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0185/review.json b/tasks_gen/eval/G0185/review.json index 284713c..d24ee23 100644 --- a/tasks_gen/eval/G0185/review.json +++ b/tasks_gen/eval/G0185/review.json @@ -1,6 +1,6 @@ { "decision": "accept", - "note": "FM interface must be read from sample; boundaries tested; fits F.", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", "by": "Claude", "date": "2026-10-03", "failed_checks": {} diff --git a/tasks_gen/eval/G0186/empirical.json b/tasks_gen/eval/G0186/empirical.json index 2ee23b1..843611f 100644 --- a/tasks_gen/eval/G0186/empirical.json +++ b/tasks_gen/eval/G0186/empirical.json @@ -1,18 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 100.0, + "score": 98.5, "parts": { "correctness": 40.0, "craft": 20.0, - "clean": 15.0, + "clean": 13.5, "own_tests": 15.0, "discipline": 10.0, - "total": 100.0, + "total": 98.5, "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "11/11", - "tool_calls": 13, - "seconds": 58.9, - "run_dir": "runs/emp/10001_G0003_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 11, + "seconds": 92.1, + "run_dir": "runs/emp/12003_G0186_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0186/review.json b/tasks_gen/eval/G0186/review.json index d4580cb..d24ee23 100644 --- a/tasks_gen/eval/G0186/review.json +++ b/tasks_gen/eval/G0186/review.json @@ -1,6 +1,6 @@ { "decision": "accept", - "note": "Rules map to tests; mutation 5/5.", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", "by": "Claude", "date": "2026-10-03", "failed_checks": {} diff --git a/tasks_gen/eval/G0187/empirical.json b/tasks_gen/eval/G0187/empirical.json index e356633..cbec907 100644 --- a/tasks_gen/eval/G0187/empirical.json +++ b/tasks_gen/eval/G0187/empirical.json @@ -1,18 +1,18 @@ { "deepseek-v4.1-flash:cloud": { - "score": 95.0, + "score": 100.0, "parts": { "correctness": 40.0, "craft": 20.0, "clean": 15.0, "own_tests": 15.0, - "discipline": 5.0, - "total": 95.0, + "discipline": 10.0, + "total": 100.0, "note": "own_tests: faulty-reference part not implemented in skeleton" }, "hidden": "12/12", - "tool_calls": 16, - "seconds": 116.4, - "run_dir": "runs/emp/10005_G0010_llm_deepseek-v4.1-flash_cloud" + "tool_calls": 13, + "seconds": 120.7, + "run_dir": "runs/emp/12002_G0187_llm_deepseek-v4.1-flash_cloud" } } \ No newline at end of file diff --git a/tasks_gen/eval/G0187/review.json b/tasks_gen/eval/G0187/review.json index 401e86e..d24ee23 100644 --- a/tasks_gen/eval/G0187/review.json +++ b/tasks_gen/eval/G0187/review.json @@ -1,6 +1,6 @@ { "decision": "accept", - "note": "Ordered stock use, case/blank rules tested; fits C.", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", "by": "Claude", "date": "2026-10-03", "failed_checks": {} diff --git a/tasks_gen/eval/G0188/empirical.json b/tasks_gen/eval/G0188/empirical.json new file mode 100644 index 0000000..3f82ba1 --- /dev/null +++ b/tasks_gen/eval/G0188/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "10/10", + "tool_calls": 6, + "seconds": 25.8, + "run_dir": "runs/emp/10055_G0188_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0189/faulty/m0_theme_fee.func.abap b/tasks_gen/eval/G0189/faulty/m0_theme_fee.func.abap new file mode 100644 index 0000000..ef3cf70 --- /dev/null +++ b/tasks_gen/eval/G0189/faulty/m0_theme_fee.func.abap @@ -0,0 +1,59 @@ +FUNCTION {{p}}theme_fee + IMPORTING + iv_visitor_type TYPE string + iv_tickets TYPE i + iv_date TYPE d + EXPORTING + ev_unit_price TYPE decfloat34 + ev_total_price TYPE decfloat34 + ev_discount TYPE decfloat34 + EXCEPTIONS + invalid_visitor_type + invalid_tickets. + + DATA lv_base_price TYPE decfloat34. + DATA lv_gross TYPE decfloat34. + DATA lv_discount_pct TYPE decfloat34. + DATA lv_month TYPE c LENGTH 2. + + IF iv_tickets <= 0. + RAISE invalid_tickets. + ENDIF. + + CASE iv_visitor_type. + WHEN 'ADULT'. + lv_base_price = '45.50'. + WHEN 'CHILD'. + lv_base_price = '25.25'. + WHEN 'SENIOR'. + lv_base_price = '30.75'. + WHEN 'FAMILY'. + lv_base_price = '40.00'. + WHEN OTHERS. + RAISE invalid_visitor_type. + ENDCASE. + + " Peak season surcharge: June, July, August + IF iv_date IS NOT INITIAL. + lv_month = iv_date+5(2). + IF lv_month = '06' OR lv_month = '07' OR lv_month = '08'. + lv_base_price = lv_base_price + 5. + ENDIF. + ENDIF. + + " Group discount + IF iv_tickets >= 20. + lv_discount_pct = 15. + ELSEIF iv_tickets >= 10. + lv_discount_pct = 10. + ENDIF. + + lv_gross = lv_base_price * iv_tickets. + ev_discount = round( val = lv_gross * lv_discount_pct / 100 + dec = 2 mode = cl_abap_math=>round_half_up ). + ev_total_price = round( val = lv_gross - ev_discount + dec = 2 mode = cl_abap_math=>round_half_up ). + ev_unit_price = round( val = lv_base_price + dec = 2 mode = cl_abap_math=>round_half_up ). + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0189/faulty/m1_theme_fee.func.abap b/tasks_gen/eval/G0189/faulty/m1_theme_fee.func.abap new file mode 100644 index 0000000..b910930 --- /dev/null +++ b/tasks_gen/eval/G0189/faulty/m1_theme_fee.func.abap @@ -0,0 +1,59 @@ +FUNCTION {{p}}theme_fee + IMPORTING + iv_visitor_type TYPE string + iv_tickets TYPE i + iv_date TYPE d + EXPORTING + ev_unit_price TYPE decfloat34 + ev_total_price TYPE decfloat34 + ev_discount TYPE decfloat34 + EXCEPTIONS + invalid_visitor_type + invalid_tickets. + + DATA lv_base_price TYPE decfloat34. + DATA lv_gross TYPE decfloat34. + DATA lv_discount_pct TYPE decfloat34. + DATA lv_month TYPE c LENGTH 2. + + IF iv_tickets <= 0. + RAISE invalid_tickets. + ENDIF. + + CASE iv_visitor_type. + WHEN 'ADULT'. + lv_base_price = '45.50'. + WHEN 'CHILD'. + lv_base_price = '25.25'. + WHEN 'SENIOR'. + lv_base_price = '30.75'. + WHEN 'FAMILY'. + lv_base_price = '40.00'. + WHEN OTHERS. + RAISE invalid_visitor_type. + ENDCASE. + + " Peak season surcharge: June, July, August + IF iv_date IS NOT INITIAL. + lv_month = iv_date+4(2). + IF lv_month = '06' OR lv_month = '07' OR lv_month <> '08'. + lv_base_price = lv_base_price + 5. + ENDIF. + ENDIF. + + " Group discount + IF iv_tickets >= 20. + lv_discount_pct = 15. + ELSEIF iv_tickets >= 10. + lv_discount_pct = 10. + ENDIF. + + lv_gross = lv_base_price * iv_tickets. + ev_discount = round( val = lv_gross * lv_discount_pct / 100 + dec = 2 mode = cl_abap_math=>round_half_up ). + ev_total_price = round( val = lv_gross - ev_discount + dec = 2 mode = cl_abap_math=>round_half_up ). + ev_unit_price = round( val = lv_base_price + dec = 2 mode = cl_abap_math=>round_half_up ). + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0189/faulty/m2_theme_fee.func.abap b/tasks_gen/eval/G0189/faulty/m2_theme_fee.func.abap new file mode 100644 index 0000000..76faa7e --- /dev/null +++ b/tasks_gen/eval/G0189/faulty/m2_theme_fee.func.abap @@ -0,0 +1,59 @@ +FUNCTION {{p}}theme_fee + IMPORTING + iv_visitor_type TYPE string + iv_tickets TYPE i + iv_date TYPE d + EXPORTING + ev_unit_price TYPE decfloat34 + ev_total_price TYPE decfloat34 + ev_discount TYPE decfloat34 + EXCEPTIONS + invalid_visitor_type + invalid_tickets. + + DATA lv_base_price TYPE decfloat34. + DATA lv_gross TYPE decfloat34. + DATA lv_discount_pct TYPE decfloat34. + DATA lv_month TYPE c LENGTH 2. + + IF iv_tickets <= 0. + RAISE invalid_tickets. + ENDIF. + + CASE iv_visitor_type. + WHEN 'ADULT'. + lv_base_price = '45.50'. + WHEN 'CHILD'. + lv_base_price = '25.25'. + WHEN 'SENIOR'. + lv_base_price = '30.75'. + WHEN 'FAMILY'. + lv_base_price = '40.00'. + WHEN OTHERS. + RAISE invalid_visitor_type. + ENDCASE. + + " Peak season surcharge: June, July, August + IF iv_date IS NOT INITIAL. + lv_month = iv_date+4(2). + IF lv_month = '06' OR lv_month = '07' OR lv_month = '08'. + lv_base_price = lv_base_price + 5. + ENDIF. + ENDIF. + + " Group discount + IF iv_tickets >= 20. + lv_discount_pct = 15. + ELSEIF iv_tickets < 10. + lv_discount_pct = 10. + ENDIF. + + lv_gross = lv_base_price * iv_tickets. + ev_discount = round( val = lv_gross * lv_discount_pct / 100 + dec = 2 mode = cl_abap_math=>round_half_up ). + ev_total_price = round( val = lv_gross - ev_discount + dec = 2 mode = cl_abap_math=>round_half_up ). + ev_unit_price = round( val = lv_base_price + dec = 2 mode = cl_abap_math=>round_half_up ). + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0189/faulty/m3_theme_fee.func.abap b/tasks_gen/eval/G0189/faulty/m3_theme_fee.func.abap new file mode 100644 index 0000000..339a2bc --- /dev/null +++ b/tasks_gen/eval/G0189/faulty/m3_theme_fee.func.abap @@ -0,0 +1,59 @@ +FUNCTION {{p}}theme_fee + IMPORTING + iv_visitor_type TYPE string + iv_tickets TYPE i + iv_date TYPE d + EXPORTING + ev_unit_price TYPE decfloat34 + ev_total_price TYPE decfloat34 + ev_discount TYPE decfloat34 + EXCEPTIONS + invalid_visitor_type + invalid_tickets. + + DATA lv_base_price TYPE decfloat34. + DATA lv_gross TYPE decfloat34. + DATA lv_discount_pct TYPE decfloat34. + DATA lv_month TYPE c LENGTH 2. + + IF iv_tickets <= 0. + RAISE invalid_tickets. + ENDIF. + + CASE iv_visitor_type. + WHEN 'ADULT'. + lv_base_price = '45.50'. + WHEN 'CHILD'. + lv_base_price = '25.25'. + WHEN 'SENIOR'. + lv_base_price = '30.75'. + WHEN 'FAMILY'. + lv_base_price = '40.00'. + WHEN OTHERS. + RAISE invalid_visitor_type. + ENDCASE. + + " Peak season surcharge: June, July, August + IF iv_date IS NOT INITIAL. + lv_month = iv_date+4(2). + IF lv_month = '06' OR lv_month = '07' OR lv_month = '08'. + lv_base_price = lv_base_price + 5. + ENDIF. + ENDIF. + + " Group discount + IF iv_tickets >= 20. + lv_discount_pct = 15. + ELSEIF iv_tickets >= 10. + lv_discount_pct = 10. + ENDIF. + + lv_gross = lv_base_price / iv_tickets. + ev_discount = round( val = lv_gross * lv_discount_pct / 100 + dec = 2 mode = cl_abap_math=>round_half_up ). + ev_total_price = round( val = lv_gross - ev_discount + dec = 2 mode = cl_abap_math=>round_half_up ). + ev_unit_price = round( val = lv_base_price + dec = 2 mode = cl_abap_math=>round_half_up ). + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0189/generation.json b/tasks_gen/eval/G0189/generation.json new file mode 100644 index 0000000..4c774e3 --- /dev/null +++ b/tasks_gen/eval/G0189/generation.json @@ -0,0 +1,45 @@ +{ + "id": "G0189", + "pool": "eval", + "object_type": "FUNC", + "category": "I", + "attempts": [ + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "validate", + "oracle": 0, + "null": 0 + }, + { + "stage": "bundle", + "errors": [ + "category I: the contract object must be the seed object that the model changes in place (same name in seed, contract and reference)" + ], + "by_check": { + "static": 1 + } + }, + { + "stage": "revalidate", + "by": "harness fix 2026-10-03", + "change": "ADT activation fallback for a second FUNC write. Bundle not changed.", + "oracle": 100.0, + "null": 0, + "mutation": { + "valid": 5, + "killed": 4, + "ok": true + } + } + ], + "accepted": true +} \ No newline at end of file diff --git a/tasks_gen/eval/G0189/hidden/duty_hidden.clas.abap b/tasks_gen/eval/G0189/hidden/duty_hidden.clas.abap deleted file mode 100644 index d3967f8..0000000 --- a/tasks_gen/eval/G0189/hidden/duty_hidden.clas.abap +++ /dev/null @@ -1,152 +0,0 @@ -CLASS {{p}}duty_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - METHODS call - IMPORTING - iv_value TYPE decfloat34 - iv_country TYPE string - iv_category TYPE string - EXPORTING - ev_rate TYPE decfloat34 - ev_duty TYPE decfloat34 - ev_subrc TYPE sysubrc. - METHODS food_rate FOR TESTING. - METHODS textile_rate FOR TESTING. - METHODS machine_rate FOR TESTING. - METHODS unknown_category FOR TESTING. - METHODS rounds_half_up FOR TESTING. - METHODS minimum_duty FOR TESTING. - METHODS zero_value FOR TESTING. - METHODS pref_no_minimum FOR TESTING. - METHODS pref_ch_de FOR TESTING. - METHODS pref_fr_it_es FOR TESTING. - METHODS negative_value FOR TESTING. -ENDCLASS. - - -CLASS {{p}}duty_hidden IMPLEMENTATION. - METHOD call. - CALL FUNCTION '{{P}}CUSTOMS_DUTY_OLD' - EXPORTING - iv_value = iv_value - iv_country = iv_country - iv_category = iv_category - IMPORTING - ev_rate = ev_rate - ev_duty = ev_duty - EXCEPTIONS - invalid_value = 1 - OTHERS = 2. - ev_subrc = sy-subrc. - ENDMETHOD. - - METHOD food_rate. - DATA lv_rate TYPE decfloat34. - DATA lv_duty TYPE decfloat34. - call( EXPORTING iv_value = 1000 iv_country = 'US' iv_category = 'FOOD' - IMPORTING ev_rate = lv_rate ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 5 ) act = lv_rate ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 50 ) act = lv_duty ). - ENDMETHOD. - - METHOD textile_rate. - DATA lv_rate TYPE decfloat34. - DATA lv_duty TYPE decfloat34. - call( EXPORTING iv_value = '250.50' iv_country = 'US' iv_category = 'TEXTILE' - IMPORTING ev_rate = lv_rate ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 12 ) act = lv_rate ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '30.06' ) act = lv_duty ). - ENDMETHOD. - - METHOD machine_rate. - DATA lv_rate TYPE decfloat34. - DATA lv_duty TYPE decfloat34. - call( EXPORTING iv_value = 2000 iv_country = 'US' iv_category = 'MACHINE' - IMPORTING ev_rate = lv_rate ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 3 ) act = lv_rate ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 60 ) act = lv_duty ). - ENDMETHOD. - - METHOD unknown_category. - DATA lv_rate TYPE decfloat34. - DATA lv_duty TYPE decfloat34. - call( EXPORTING iv_value = 1000 iv_country = 'US' iv_category = 'TOY' - IMPORTING ev_rate = lv_rate ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ). - ENDMETHOD. - - METHOD rounds_half_up. - DATA lv_duty TYPE decfloat34. - call( EXPORTING iv_value = '123.7' iv_country = 'US' iv_category = 'FOOD' - IMPORTING ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '6.19' ) act = lv_duty ). - - call( EXPORTING iv_value = '123.45' iv_country = 'US' iv_category = 'FOOD' - IMPORTING ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '6.17' ) act = lv_duty ). - ENDMETHOD. - - METHOD minimum_duty. - DATA lv_duty TYPE decfloat34. - call( EXPORTING iv_value = 50 iv_country = 'US' iv_category = 'FOOD' - IMPORTING ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 5 ) act = lv_duty ). - ENDMETHOD. - - METHOD zero_value. - DATA lv_rate TYPE decfloat34. - DATA lv_duty TYPE decfloat34. - DATA lv_subrc TYPE sysubrc. - call( EXPORTING iv_value = 0 iv_country = 'US' iv_category = 'FOOD' - IMPORTING ev_rate = lv_rate ev_duty = lv_duty ev_subrc = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 5 ) act = lv_rate ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ). - ENDMETHOD. - - METHOD pref_no_minimum. - DATA lv_rate TYPE decfloat34. - DATA lv_duty TYPE decfloat34. - call( EXPORTING iv_value = 10000 iv_country = 'CH' iv_category = 'TEXTILE' - IMPORTING ev_rate = lv_rate ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ). - ENDMETHOD. - - METHOD pref_ch_de. - DATA lv_rate TYPE decfloat34. - DATA lv_duty TYPE decfloat34. - call( EXPORTING iv_value = 10000 iv_country = 'DE' iv_category = 'MACHINE' - IMPORTING ev_rate = lv_rate ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ). - ENDMETHOD. - - METHOD pref_fr_it_es. - DATA lv_rate TYPE decfloat34. - DATA lv_duty TYPE decfloat34. - call( EXPORTING iv_value = 10000 iv_country = 'FR' iv_category = 'FOOD' - IMPORTING ev_rate = lv_rate ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ). - - call( EXPORTING iv_value = 10000 iv_country = 'IT' iv_category = 'FOOD' - IMPORTING ev_rate = lv_rate ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ). - - call( EXPORTING iv_value = 10000 iv_country = 'ES' iv_category = 'FOOD' - IMPORTING ev_rate = lv_rate ev_duty = lv_duty ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_rate ). - cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_duty ). - ENDMETHOD. - - METHOD negative_value. - DATA lv_duty TYPE decfloat34. - DATA lv_subrc TYPE sysubrc. - call( EXPORTING iv_value = -100 iv_country = 'US' iv_category = 'FOOD' - IMPORTING ev_duty = lv_duty ev_subrc = lv_subrc ). - cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0189/hidden/theme_hidden.clas.abap b/tasks_gen/eval/G0189/hidden/theme_hidden.clas.abap new file mode 100644 index 0000000..23ff7ed --- /dev/null +++ b/tasks_gen/eval/G0189/hidden/theme_hidden.clas.abap @@ -0,0 +1,127 @@ +CLASS {{p}}theme_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS call + IMPORTING + iv_type TYPE string + iv_tickets TYPE i + iv_date TYPE d + EXPORTING + ev_unit TYPE decfloat34 + ev_total TYPE decfloat34 + ev_discount TYPE decfloat34 + ev_subrc TYPE sysubrc. + METHODS peak_season_surcharge FOR TESTING. + METHODS no_surcharge_off_peak FOR TESTING. + METHODS discount_tiers FOR TESTING. + METHODS discount_rounding FOR TESTING. + METHODS base_prices FOR TESTING. + METHODS invalid_visitor_type FOR TESTING. + METHODS invalid_tickets FOR TESTING. + METHODS unit_price_with_surcharge FOR TESTING. +ENDCLASS. + + +CLASS {{p}}theme_hidden IMPLEMENTATION. + METHOD call. + CALL FUNCTION '{{P}}THEME_FEE' + EXPORTING + iv_visitor_type = iv_type + iv_tickets = iv_tickets + iv_date = iv_date + IMPORTING + ev_unit_price = ev_unit + ev_total_price = ev_total + ev_discount = ev_discount + EXCEPTIONS + invalid_visitor_type = 1 + invalid_tickets = 2 + OTHERS = 3. + ev_subrc = sy-subrc. + ENDMETHOD. + + METHOD peak_season_surcharge. + call( EXPORTING iv_type = 'ADULT' iv_tickets = 1 iv_date = '20250715' + IMPORTING ev_unit = DATA(lv_jul) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '50.50' ) act = lv_jul ). + call( EXPORTING iv_type = 'ADULT' iv_tickets = 1 iv_date = '20250801' + IMPORTING ev_unit = DATA(lv_aug) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '50.50' ) act = lv_aug ). + call( EXPORTING iv_type = 'ADULT' iv_tickets = 1 iv_date = '20250630' + IMPORTING ev_unit = DATA(lv_jun) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '50.50' ) act = lv_jun ). + ENDMETHOD. + + METHOD no_surcharge_off_peak. + call( EXPORTING iv_type = 'ADULT' iv_tickets = 1 iv_date = '20250115' + IMPORTING ev_unit = DATA(lv_jan) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '45.50' ) act = lv_jan ). + call( EXPORTING iv_type = 'ADULT' iv_tickets = 1 iv_date = '20251215' + IMPORTING ev_unit = DATA(lv_dec) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '45.50' ) act = lv_dec ). + call( EXPORTING iv_type = 'ADULT' iv_tickets = 1 iv_date = '20250531' + IMPORTING ev_unit = DATA(lv_may) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '45.50' ) act = lv_may ). + ENDMETHOD. + + METHOD discount_tiers. + call( EXPORTING iv_type = 'ADULT' iv_tickets = 9 iv_date = '20250115' + IMPORTING ev_discount = DATA(lv_d9) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_d9 ). + call( EXPORTING iv_type = 'ADULT' iv_tickets = 10 iv_date = '20250115' + IMPORTING ev_discount = DATA(lv_d10) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '45.50' ) act = lv_d10 ). + call( EXPORTING iv_type = 'ADULT' iv_tickets = 19 iv_date = '20250115' + IMPORTING ev_discount = DATA(lv_d19) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '86.45' ) act = lv_d19 ). + call( EXPORTING iv_type = 'ADULT' iv_tickets = 20 iv_date = '20250115' + IMPORTING ev_discount = DATA(lv_d20) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '136.50' ) act = lv_d20 ). + call( EXPORTING iv_type = 'ADULT' iv_tickets = 25 iv_date = '20250115' + IMPORTING ev_discount = DATA(lv_d25) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '170.63' ) act = lv_d25 ). + ENDMETHOD. + + METHOD discount_rounding. + call( EXPORTING iv_type = 'ADULT' iv_tickets = 25 iv_date = '20250115' + IMPORTING ev_discount = DATA(lv_disc) ev_total = DATA(lv_total) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '170.63' ) act = lv_disc ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '966.87' ) act = lv_total ). + ENDMETHOD. + + METHOD base_prices. + call( EXPORTING iv_type = 'ADULT' iv_tickets = 1 iv_date = '20250115' + IMPORTING ev_unit = DATA(lv_adult) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '45.50' ) act = lv_adult ). + call( EXPORTING iv_type = 'CHILD' iv_tickets = 1 iv_date = '20250115' + IMPORTING ev_unit = DATA(lv_child) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '25.25' ) act = lv_child ). + call( EXPORTING iv_type = 'SENIOR' iv_tickets = 1 iv_date = '20250115' + IMPORTING ev_unit = DATA(lv_senior) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '30.75' ) act = lv_senior ). + call( EXPORTING iv_type = 'FAMILY' iv_tickets = 1 iv_date = '20250115' + IMPORTING ev_unit = DATA(lv_family) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '40.00' ) act = lv_family ). + ENDMETHOD. + + METHOD invalid_visitor_type. + call( EXPORTING iv_type = 'STUDENT' iv_tickets = 1 iv_date = '20250115' + IMPORTING ev_subrc = DATA(lv_rc) ). + cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ). + ENDMETHOD. + + METHOD invalid_tickets. + call( EXPORTING iv_type = 'ADULT' iv_tickets = 0 iv_date = '20250115' + IMPORTING ev_subrc = DATA(lv_rc0) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc0 ). + call( EXPORTING iv_type = 'ADULT' iv_tickets = -1 iv_date = '20250115' + IMPORTING ev_subrc = DATA(lv_rc1) ). + cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc1 ). + ENDMETHOD. + + METHOD unit_price_with_surcharge. + call( EXPORTING iv_type = 'CHILD' iv_tickets = 1 iv_date = '20250704' + IMPORTING ev_unit = DATA(lv_unit) ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '30.25' ) act = lv_unit ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0189/mutation.json b/tasks_gen/eval/G0189/mutation.json index 033261d..bcd0b41 100644 --- a/tasks_gen/eval/G0189/mutation.json +++ b/tasks_gen/eval/G0189/mutation.json @@ -1,58 +1,58 @@ { - "task": "T14", + "task": "G0189", "mutants": [ { - "object": "{{P}}CUSTOMS_DUTY_OLD", - "mutant": "line 14: < -> <= (rel)", + "object": "{{P}}THEME_FEE", + "mutant": "line 38: 4 -> 5 (const)", "status": "killed", - "hidden": "10/11", + "hidden": "6/8", "failed_tests": [ - "ZERO_VALUE" + "PEAK_SEASON_SURCHARGE", + "UNIT_PRICE_WITH_SURCHARGE" ] }, { - "object": "{{P}}CUSTOMS_DUTY_OLD", - "mutant": "line 22: 12 -> 15 (const)", + "object": "{{P}}THEME_FEE", + "mutant": "line 39: = -> <> (eq)", "status": "killed", - "hidden": "10/11", + "hidden": "3/8", "failed_tests": [ - "TEXTILE_RATE" + "BASE_PRICES", + "DISCOUNT_ROUNDING", + "DISCOUNT_TIERS", + "NO_SURCHARGE_OFF_PEAK", + "PEAK_SEASON_SURCHARGE" ] }, { - "object": "{{P}}CUSTOMS_DUTY_OLD", - "mutant": "line 30: 'ES' -> 'XX' (const)", + "object": "{{P}}THEME_FEE", + "mutant": "line 47: >= -> < (rel)", "status": "killed", - "hidden": "10/11", + "hidden": "7/8", "failed_tests": [ - "PREF_FR_IT_ES" + "DISCOUNT_TIERS" ] }, { - "object": "{{P}}CUSTOMS_DUTY_OLD", - "mutant": "line 35: round() -> plain (arith)", + "object": "{{P}}THEME_FEE", + "mutant": "line 51: * -> / (arith)", "status": "killed", - "hidden": "10/11", + "hidden": "6/8", "failed_tests": [ - "ROUNDS_HALF_UP" + "DISCOUNT_ROUNDING", + "DISCOUNT_TIERS" ] }, { - "object": "{{P}}CUSTOMS_DUTY_OLD", - "mutant": "line 37: ev_duty > 0 AND -> removed (bool)", - "status": "killed", - "hidden": "6/11", - "failed_tests": [ - "PREF_NO_MINIMUM", - "PREF_CH_DE", - "PREF_FR_IT_ES", - "UNKNOWN_CATEGORY", - "ZERO_VALUE" - ] + "object": "{{P}}THEME_FEE", + "mutant": "line 55: 2 -> 3 (const)", + "status": "survived", + "hidden": "8/8", + "failed_tests": [] } ], "valid": 5, - "killed": 5, - "kill_rate": 1.0, + "killed": 4, + "kill_rate": 0.8, "ok": true } \ No newline at end of file diff --git a/tasks_gen/eval/G0189/reference/customs_duty_old.func.abap b/tasks_gen/eval/G0189/reference/customs_duty_old.func.abap deleted file mode 100644 index 9b7fd48..0000000 --- a/tasks_gen/eval/G0189/reference/customs_duty_old.func.abap +++ /dev/null @@ -1,41 +0,0 @@ -FUNCTION {{p}}customs_duty_old - IMPORTING - iv_value TYPE decfloat34 - iv_country TYPE string - iv_category TYPE string - EXPORTING - ev_rate TYPE decfloat34 - ev_duty TYPE decfloat34 - EXCEPTIONS - invalid_value. - - DATA lv_rate TYPE decfloat34. - - IF iv_value < 0. - RAISE invalid_value. - ENDIF. - - CASE iv_category. - WHEN 'FOOD'. - lv_rate = 5. - WHEN 'TEXTILE'. - lv_rate = 12. - WHEN 'MACHINE'. - lv_rate = 3. - WHEN OTHERS. - lv_rate = 0. - ENDCASE. - - IF iv_country = 'CH' OR iv_country = 'DE' OR iv_country = 'FR' - OR iv_country = 'IT' OR iv_country = 'ES'. - lv_rate = 0. - ENDIF. - - ev_rate = lv_rate. - ev_duty = round( val = iv_value * lv_rate / 100 dec = 2 ). - - IF ev_duty > 0 AND ev_duty < 5. - ev_duty = 5. - ENDIF. - -ENDFUNCTION. diff --git a/tasks_gen/eval/G0189/reference/duty_test.clas.abap b/tasks_gen/eval/G0189/reference/duty_test.clas.abap deleted file mode 100644 index f035953..0000000 --- a/tasks_gen/eval/G0189/reference/duty_test.clas.abap +++ /dev/null @@ -1,72 +0,0 @@ -CLASS {{p}}duty_test DEFINITION PUBLIC FINAL CREATE PUBLIC - FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. - PRIVATE SECTION. - METHODS duty_for - IMPORTING - iv_value TYPE decfloat34 - iv_country TYPE string - iv_category TYPE string - RETURNING - VALUE(rv_duty) TYPE decfloat34. - METHODS food_duty FOR TESTING. - METHODS rounding FOR TESTING. - METHODS minimum FOR TESTING. - METHODS preferential FOR TESTING. - METHODS negative_value FOR TESTING. -ENDCLASS. - - -CLASS {{p}}duty_test IMPLEMENTATION. - METHOD duty_for. - CALL FUNCTION '{{P}}CUSTOMS_DUTY_OLD' - EXPORTING - iv_value = iv_value - iv_country = iv_country - iv_category = iv_category - IMPORTING - ev_duty = rv_duty - EXCEPTIONS - invalid_value = 1 - OTHERS = 2. - cl_abap_unit_assert=>assert_subrc( exp = 0 ). - ENDMETHOD. - - METHOD food_duty. - cl_abap_unit_assert=>assert_equals( - exp = CONV decfloat34( 50 ) - act = duty_for( iv_value = 1000 iv_country = 'US' iv_category = 'FOOD' ) ). - ENDMETHOD. - - METHOD rounding. - cl_abap_unit_assert=>assert_equals( - exp = CONV decfloat34( '6.19' ) - act = duty_for( iv_value = '123.7' iv_country = 'US' iv_category = 'FOOD' ) ). - ENDMETHOD. - - METHOD minimum. - cl_abap_unit_assert=>assert_equals( - exp = CONV decfloat34( 5 ) - act = duty_for( iv_value = 50 iv_country = 'US' iv_category = 'FOOD' ) ). - ENDMETHOD. - - METHOD preferential. - cl_abap_unit_assert=>assert_equals( - exp = CONV decfloat34( 0 ) - act = duty_for( iv_value = 10000 iv_country = 'FR' iv_category = 'FOOD' ) ). - ENDMETHOD. - - METHOD negative_value. - DATA lv_duty TYPE decfloat34. - CALL FUNCTION '{{P}}CUSTOMS_DUTY_OLD' - EXPORTING - iv_value = -1 - iv_country = 'US' - iv_category = 'FOOD' - IMPORTING - ev_duty = lv_duty - EXCEPTIONS - invalid_value = 1 - OTHERS = 2. - cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ). - ENDMETHOD. -ENDCLASS. diff --git a/tasks_gen/eval/G0189/reference/theme_fee.func.abap b/tasks_gen/eval/G0189/reference/theme_fee.func.abap new file mode 100644 index 0000000..a9b84b5 --- /dev/null +++ b/tasks_gen/eval/G0189/reference/theme_fee.func.abap @@ -0,0 +1,59 @@ +FUNCTION {{p}}theme_fee + IMPORTING + iv_visitor_type TYPE string + iv_tickets TYPE i + iv_date TYPE d + EXPORTING + ev_unit_price TYPE decfloat34 + ev_total_price TYPE decfloat34 + ev_discount TYPE decfloat34 + EXCEPTIONS + invalid_visitor_type + invalid_tickets. + + DATA lv_base_price TYPE decfloat34. + DATA lv_gross TYPE decfloat34. + DATA lv_discount_pct TYPE decfloat34. + DATA lv_month TYPE c LENGTH 2. + + IF iv_tickets <= 0. + RAISE invalid_tickets. + ENDIF. + + CASE iv_visitor_type. + WHEN 'ADULT'. + lv_base_price = '45.50'. + WHEN 'CHILD'. + lv_base_price = '25.25'. + WHEN 'SENIOR'. + lv_base_price = '30.75'. + WHEN 'FAMILY'. + lv_base_price = '40.00'. + WHEN OTHERS. + RAISE invalid_visitor_type. + ENDCASE. + + " Peak season surcharge: June, July, August + IF iv_date IS NOT INITIAL. + lv_month = iv_date+4(2). + IF lv_month = '06' OR lv_month = '07' OR lv_month = '08'. + lv_base_price = lv_base_price + 5. + ENDIF. + ENDIF. + + " Group discount + IF iv_tickets >= 20. + lv_discount_pct = 15. + ELSEIF iv_tickets >= 10. + lv_discount_pct = 10. + ENDIF. + + lv_gross = lv_base_price * iv_tickets. + ev_discount = round( val = lv_gross * lv_discount_pct / 100 + dec = 2 mode = cl_abap_math=>round_half_up ). + ev_total_price = round( val = lv_gross - ev_discount + dec = 2 mode = cl_abap_math=>round_half_up ). + ev_unit_price = round( val = lv_base_price + dec = 2 mode = cl_abap_math=>round_half_up ). + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0189/reference/theme_test.clas.abap b/tasks_gen/eval/G0189/reference/theme_test.clas.abap new file mode 100644 index 0000000..aeb42aa --- /dev/null +++ b/tasks_gen/eval/G0189/reference/theme_test.clas.abap @@ -0,0 +1,68 @@ +CLASS {{p}}theme_test DEFINITION PUBLIC FINAL CREATE PUBLIC + FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. + PRIVATE SECTION. + METHODS fee_for + IMPORTING + iv_type TYPE string + iv_tickets TYPE i + iv_date TYPE d + RETURNING VALUE(rv_total) TYPE decfloat34. + METHODS adult_price FOR TESTING. + METHODS child_price FOR TESTING. + METHODS group_discount FOR TESTING. + METHODS peak_season FOR TESTING. + METHODS invalid_type FOR TESTING. +ENDCLASS. + + +CLASS {{p}}theme_test IMPLEMENTATION. + METHOD fee_for. + CALL FUNCTION '{{P}}THEME_FEE' + EXPORTING + iv_visitor_type = iv_type + iv_tickets = iv_tickets + iv_date = iv_date + IMPORTING + ev_total_price = rv_total + EXCEPTIONS + invalid_visitor_type = 1 + invalid_tickets = 2 + OTHERS = 3. + cl_abap_unit_assert=>assert_subrc( exp = 0 ). + ENDMETHOD. + + METHOD adult_price. + DATA(lv_total) = fee_for( iv_type = 'ADULT' iv_tickets = 1 iv_date = '20250115' ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '45.50' ) act = lv_total ). + ENDMETHOD. + + METHOD child_price. + DATA(lv_total) = fee_for( iv_type = 'CHILD' iv_tickets = 1 iv_date = '20250115' ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '25.25' ) act = lv_total ). + ENDMETHOD. + + METHOD group_discount. + DATA(lv_total) = fee_for( iv_type = 'ADULT' iv_tickets = 10 iv_date = '20250115' ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '409.50' ) act = lv_total ). + ENDMETHOD. + + METHOD peak_season. + DATA(lv_total) = fee_for( iv_type = 'ADULT' iv_tickets = 1 iv_date = '20250715' ). + cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '50.50' ) act = lv_total ). + ENDMETHOD. + + METHOD invalid_type. + DATA lv_total TYPE decfloat34. + CALL FUNCTION '{{P}}THEME_FEE' + EXPORTING + iv_visitor_type = 'STUDENT' + iv_tickets = 1 + iv_date = '20250115' + IMPORTING + ev_total_price = lv_total + EXCEPTIONS + invalid_visitor_type = 1 + OTHERS = 2. + cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ). + ENDMETHOD. +ENDCLASS. diff --git a/tasks_gen/eval/G0189/seed/customs_duty_old.func.abap b/tasks_gen/eval/G0189/seed/customs_duty_old.func.abap deleted file mode 100644 index ea65de0..0000000 --- a/tasks_gen/eval/G0189/seed/customs_duty_old.func.abap +++ /dev/null @@ -1,36 +0,0 @@ -FUNCTION {{p}}customs_duty_old - IMPORTING - iv_value TYPE decfloat34 - iv_country TYPE string - iv_category TYPE string - EXPORTING - ev_rate TYPE decfloat34 - ev_duty TYPE decfloat34 - EXCEPTIONS - invalid_value. - - DATA lv_rate TYPE decfloat34. - - CASE iv_category. - WHEN 'FOOD'. - lv_rate = 5. - WHEN 'TEXTILE'. - lv_rate = 12. - WHEN 'MACHINE'. - lv_rate = 3. - WHEN OTHERS. - lv_rate = 0. - ENDCASE. - - IF iv_country = 'CH' OR iv_country = 'DE'. - lv_rate = 0. - ENDIF. - - ev_rate = lv_rate. - ev_duty = iv_value * lv_rate / 100. - - IF ev_duty < 5. - ev_duty = 5. - ENDIF. - -ENDFUNCTION. diff --git a/tasks_gen/eval/G0189/seed/theme_fee.func.abap b/tasks_gen/eval/G0189/seed/theme_fee.func.abap new file mode 100644 index 0000000..77a95f0 --- /dev/null +++ b/tasks_gen/eval/G0189/seed/theme_fee.func.abap @@ -0,0 +1,53 @@ +FUNCTION {{p}}theme_fee + IMPORTING + iv_visitor_type TYPE string + iv_tickets TYPE i + iv_date TYPE d + EXPORTING + ev_unit_price TYPE decfloat34 + ev_total_price TYPE decfloat34 + ev_discount TYPE decfloat34 + EXCEPTIONS + invalid_visitor_type + invalid_tickets. + + DATA lv_base_price TYPE decfloat34. + DATA lv_gross TYPE decfloat34. + DATA lv_discount_pct TYPE decfloat34. + + IF iv_tickets <= 0. + RAISE invalid_tickets. + ENDIF. + + CASE iv_visitor_type. + WHEN 'ADULT'. + lv_base_price = '45.50'. + WHEN 'CHILD'. + lv_base_price = '25.25'. + WHEN 'SENIOR'. + lv_base_price = '30.75'. + WHEN 'FAMILY'. + lv_base_price = '40.00'. + WHEN OTHERS. + RAISE invalid_visitor_type. + ENDCASE. + + " Peak season surcharge + IF iv_date IS NOT INITIAL. + lv_base_price = lv_base_price + 5. + ENDIF. + + " Group discount + IF iv_tickets >= 10. + lv_discount_pct = 10. + ENDIF. + IF iv_tickets > 20. + lv_discount_pct = 15. + ENDIF. + + lv_gross = lv_base_price * iv_tickets. + ev_discount = lv_gross * lv_discount_pct / 100. + ev_total_price = lv_gross - ev_discount. + ev_unit_price = lv_base_price. + +ENDFUNCTION. diff --git a/tasks_gen/eval/G0189/spec.md b/tasks_gen/eval/G0189/spec.md index 7d2ca3c..90bd1c8 100644 --- a/tasks_gen/eval/G0189/spec.md +++ b/tasks_gen/eval/G0189/spec.md @@ -1,54 +1,53 @@ # 1. Goal -A customs broker calculates the import duty for a shipment. The broker program -calls one function module for each shipment. The function module -{{P}}CUSTOMS_DUTY_OLD calculates the duty rate and the duty. Users report -several defects. Fix the function module in place. All other behavior stays the -same. +The function module {{P}}THEME_FEE calculates the price of a theme park ticket +order. Users report three defects. Fix the defects in the function module. All +other behavior stays the same. # 2. Open questions None. # 3. Context -- Function group {{P}}FG_CUST exists in package $TMP. -- Function module {{P}}CUSTOMS_DUTY_OLD exists in this group. It is the only - function module in the group. Read its source. It defines the duty rates of - the goods categories and all the other behavior that must stay the same. -- The broker program calls the function module with a customs value, a country - of origin and a goods category. The program reads the duty rate and the duty. +- Function group {{P}}FG_THEME exists in package $TMP. +- Function module {{P}}THEME_FEE exists in this group. It is the function + module that the ticket program calls. +- The function module has defects. Read the existing code before you change + it. The existing code holds rules that this specification does not repeat. # 4. Contract -- Fix the function module {{P}}CUSTOMS_DUTY_OLD in function group {{P}}FG_CUST. -- Do not change the interface. The parameters are: - - IV_VALUE, importing, decfloat34: the customs value in euro. - - IV_COUNTRY, importing, string: the country of origin. - - IV_CATEGORY, importing, string: the goods category. - - EV_RATE, exporting, decfloat34: the duty rate in percent. - - EV_DUTY, exporting, decfloat34: the duty in euro. - - The exception INVALID_VALUE stays. +- Function module {{P}}THEME_FEE in function group {{P}}FG_THEME. +- Parameters: + - iv_visitor_type TYPE string + - iv_tickets TYPE i + - iv_date TYPE d + - ev_unit_price TYPE decfloat34 + - ev_total_price TYPE decfloat34 + - ev_discount TYPE decfloat34 +- Exceptions: invalid_visitor_type, invalid_tickets. +- Do not change the interface. # 5. Business rules -1. The duty is rounded half up to 2 decimals. Users report duties with more - than 2 decimals, for example 6.185 instead of 6.19. -2. The minimum duty is 5.00. The minimum applies only to a shipment that has a - duty. A shipment with a duty of zero keeps a duty of zero. Users report that - duty-free shipments are charged 5.00. -3. A shipment with a preferential origin is duty-free: the duty is 0 and the - rate is 0. The preferential origins are Switzerland (CH), Germany (DE), - France (FR), Italy (IT) and Spain (ES). Users report that shipments from - France, Italy and Spain are charged duty. -4. A negative customs value is not valid. Users report that a negative value is - accepted and gives a duty. The function module must raise the exception - INVALID_VALUE for a negative customs value. -5. The duty rates of the goods categories and all other behavior stay the same - as they are in {{P}}CUSTOMS_DUTY_OLD today. +The function module calculates the price of a theme park ticket order. These +defects are reported: + +1. Peak season surcharge: The surcharge must apply only to visit dates in + June, July, or August. Currently the surcharge applies to all dates. +2. Group discount: An order with 20 tickets or more must get a 15 % discount. + Currently an order with exactly 20 tickets gets only 10 %. An order with 10 + to 19 tickets must get a 10 % discount. An order with fewer than 10 tickets + must get no discount. +3. Rounding: The discount amount and the total price must be rounded to 2 + decimals, half up. Currently they are not rounded. The discount amount is + rounded first. The total price is the gross amount minus the rounded + discount amount, rounded to 2 decimals. + +All other behavior stays the same. # 6. Constraints -- Release target: 8.16 (SAP_BASIS 816, ABAP Platform 2025). -- Package $TMP. Do not use transports. -- Out of scope: do not change other objects. -- Clean ABAP. Keep the methods below 40 statements. +- Release target: SAP_BASIS 816. +- Do not change the function module interface. +- Out of scope: no other object. # 7. Acceptance -- The function module {{P}}CUSTOMS_DUTY_OLD is active and has no syntax error. +- The function module is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests for the function module in a global test class. diff --git a/tasks_gen/eval/G0189/task.json b/tasks_gen/eval/G0189/task.json index 497063d..df3fe97 100644 --- a/tasks_gen/eval/G0189/task.json +++ b/tasks_gen/eval/G0189/task.json @@ -6,47 +6,51 @@ "release_target": "v816", "expected_outcome": "implement", "budget": { - "max_tool_calls": 40, - "max_activations": 10 + "max_tool_calls": 60, + "max_activations": 15 }, "seed": [ { "type": "FUGR", - "name": "{{P}}FG_CUST", - "description": "Customs duty function group" + "name": "{{P}}FG_THEME", + "description": "Theme park ticket fee" }, { "type": "FUNC", - "name": "{{P}}CUSTOMS_DUTY_OLD", - "functionGroup": "{{P}}FG_CUST", - "file": "seed/customs_duty_old.func.abap", - "description": "Legacy customs duty calculation with defects" + "name": "{{P}}THEME_FEE", + "functionGroup": "{{P}}FG_THEME", + "file": "seed/theme_fee.func.abap", + "description": "Theme park ticket fee" } ], "contract": [ { "type": "FUNC", - "name": "{{P}}CUSTOMS_DUTY_OLD", - "functionGroup": "{{P}}FG_CUST", + "name": "{{P}}THEME_FEE", + "functionGroup": "{{P}}FG_THEME", "params": [ { - "name": "iv_value", - "type": "decfloat34" - }, - { - "name": "iv_country", + "name": "iv_visitor_type", "type": "string" }, { - "name": "iv_category", - "type": "string" + "name": "iv_tickets", + "type": "i" }, { - "name": "ev_rate", + "name": "iv_date", + "type": "d" + }, + { + "name": "ev_unit_price", "type": "decfloat34" }, { - "name": "ev_duty", + "name": "ev_total_price", + "type": "decfloat34" + }, + { + "name": "ev_discount", "type": "decfloat34" } ] @@ -56,25 +60,24 @@ "hidden_tests": [ { "type": "CLAS", - "name": "{{P}}DUTY_HIDDEN", - "file": "hidden/duty_hidden.clas.abap", - "description": "Hidden tests for the customs duty function module" + "name": "{{P}}THEME_HIDDEN", + "file": "hidden/theme_hidden.clas.abap", + "description": "Hidden tests for theme park ticket fee" } ], "reference": [ { "type": "FUNC", - "name": "{{P}}CUSTOMS_DUTY_OLD", - "functionGroup": "{{P}}FG_CUST", - "existing": true, - "file": "reference/customs_duty_old.func.abap", - "description": "Fixed customs duty calculation" + "name": "{{P}}THEME_FEE", + "functionGroup": "{{P}}FG_THEME", + "file": "reference/theme_fee.func.abap", + "description": "Theme park ticket fee" }, { "type": "CLAS", - "name": "{{P}}DUTY_TEST", - "file": "reference/duty_test.clas.abap", - "description": "Own tests for the customs duty function module" + "name": "{{P}}THEME_TEST", + "file": "reference/theme_test.clas.abap", + "description": "Own tests for theme park ticket fee" } ], "craft_checks": [ diff --git a/tasks_gen/eval/G0190/empirical.json b/tasks_gen/eval/G0190/empirical.json new file mode 100644 index 0000000..ffa6445 --- /dev/null +++ b/tasks_gen/eval/G0190/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 90.0, + "parts": { + "correctness": 40.0, + "craft": 15.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 5.0, + "total": 90.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "7/7", + "tool_calls": 19, + "seconds": 852.8, + "run_dir": "runs/emp/12001_G0190_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0190/review.json b/tasks_gen/eval/G0190/review.json new file mode 100644 index 0000000..ebc3eea --- /dev/null +++ b/tasks_gen/eval/G0190/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Survived mutant: round dec +1, equivalent (result field has fewer decimals).", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file diff --git a/tasks_gen/eval/G0191/empirical.json b/tasks_gen/eval/G0191/empirical.json new file mode 100644 index 0000000..beb41ee --- /dev/null +++ b/tasks_gen/eval/G0191/empirical.json @@ -0,0 +1,18 @@ +{ + "deepseek-v4.1-flash:cloud": { + "score": 100.0, + "parts": { + "correctness": 40.0, + "craft": 20.0, + "clean": 15.0, + "own_tests": 15.0, + "discipline": 10.0, + "total": 100.0, + "note": "own_tests: faulty-reference part not implemented in skeleton" + }, + "hidden": "12/12", + "tool_calls": 8, + "seconds": 87.0, + "run_dir": "runs/emp/12000_G0191_llm_deepseek-v4.1-flash_cloud" + } +} \ No newline at end of file diff --git a/tasks_gen/eval/G0191/review.json b/tasks_gen/eval/G0191/review.json new file mode 100644 index 0000000..d24ee23 --- /dev/null +++ b/tasks_gen/eval/G0191/review.json @@ -0,0 +1,7 @@ +{ + "decision": "accept", + "note": "Screened: rules map to tests, mutation ok, no craft hints. H: real gap. K: names kept.", + "by": "Claude", + "date": "2026-10-03", + "failed_checks": {} +} \ No newline at end of file