aboutsummaryrefslogtreecommitdiff
path: root/tests/ii
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.one>2026-10-16 20:54:00 +0800
committer_ov4 <ov4@ov4.one>2026-10-16 20:54:00 +0800
commit670b0d8a4669d939b09b4990be89173805831215 (patch)
tree0a4ea2f071ed574b62782cb0002ddf6eec2bb5c3 /tests/ii
parentf1f01c0622a9045e26335f5715a42342d0191dcd (diff)
ci(compiler): gate platform packages on reproducible compiler tests
Run all three suites on Linux, macOS and Windows with the push SHA as seed. Retain failure evidence and document the 12 existing failures, pending human review and remaining coverage gaps. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'tests/ii')
-rw-r--r--tests/ii/arithmetic/notes.md2
-rw-r--r--tests/ii/arithmetic/program.cps18
-rw-r--r--tests/ii/arithmetic/reference.cc5
-rw-r--r--tests/ii/generator-vectors.json9
4 files changed, 32 insertions, 2 deletions
diff --git a/tests/ii/arithmetic/notes.md b/tests/ii/arithmetic/notes.md
index 947a3fa..d152e29 100644
--- a/tests/ii/arithmetic/notes.md
+++ b/tests/ii/arithmetic/notes.md
@@ -3,3 +3,5 @@
CIE pp. 15-16, project i64 and truncation-towards-zero DIV/MOD. Full-width extremes are used only in safe division/remainder and comparisons; addition, subtraction and multiplication use A MOD 1000001. B is nonzero, and INT64_MIN / -1 is never generated.
Each record produces exactly one output line. Random records are preceded by fixed boundary records; every arithmetic intermediate is bounded.
+
+Nested IF classifies the sign; CASE tests an inclusive -10..10 range before an overlapping zero label, so zero must select the first range. The oracle computes these results without reproducing the pseudocode control flow.
diff --git a/tests/ii/arithmetic/program.cps b/tests/ii/arithmetic/program.cps
index 7c4bf52..e13381b 100644
--- a/tests/ii/arithmetic/program.cps
+++ b/tests/ii/arithmetic/program.cps
@@ -3,10 +3,26 @@ DECLARE Index : INTEGER
DECLARE A : INTEGER
DECLARE B : INTEGER
DECLARE Small : INTEGER
+DECLARE Sign : INTEGER
+DECLARE Band : INTEGER
INPUT Count
FOR Index <- 1 TO Count
INPUT A
INPUT B
Small <- A MOD 1000001
- OUTPUT A < B, ":", A DIV B, ":", A MOD B, ":", Small + B, ":", Small - B, ":", Small * B
+ IF A < 0 THEN
+ Sign <- -1
+ ELSE
+ IF A = 0 THEN
+ Sign <- 0
+ ELSE
+ Sign <- 1
+ ENDIF
+ ENDIF
+ CASE OF Small
+ -10 TO 10 : Band <- 2
+ 0 : Band <- 99
+ OTHERWISE : Band <- 3
+ ENDCASE
+ OUTPUT A < B, ":", A DIV B, ":", A MOD B, ":", Small + B, ":", Small - B, ":", Small * B, ":", Sign, ":", Band
NEXT Index
diff --git a/tests/ii/arithmetic/reference.cc b/tests/ii/arithmetic/reference.cc
index 6d3d98f..3e0b27f 100644
--- a/tests/ii/arithmetic/reference.cc
+++ b/tests/ii/arithmetic/reference.cc
@@ -7,7 +7,10 @@ int main() {
std::int64_t a, b;
if (!(std::cin >> a >> b) || b == 0) return 1;
auto small = a % 1000001;
+ int sign = (a > 0) - (a < 0);
+ int band = small >= -10 && small <= 10 ? 2 : 3;
std::cout << (a < b ? "TRUE" : "FALSE") << ':' << a / b << ':' << a % b
- << ':' << small + b << ':' << small - b << ':' << small * b << '\n';
+ << ':' << small + b << ':' << small - b << ':' << small * b
+ << ':' << sign << ':' << band << '\n';
}
}
diff --git a/tests/ii/generator-vectors.json b/tests/ii/generator-vectors.json
new file mode 100644
index 0000000..8d08da7
--- /dev/null
+++ b/tests/ii/generator-vectors.json
@@ -0,0 +1,9 @@
+{
+ "arithmetic": "fa1b753544b05a783d1291aefea47a3288bbdf1339e912b55c6ed01e16b82588",
+ "arrays": "be2bad75adcf82776e7de77bb4992c31994b11984eac7b9cb3d225ca0fcf9e9d",
+ "calls": "1933d62e59a50ab51eca103b012ba69064651de0af06b62ff48a6235c47405ee",
+ "files": "0addc4652097fed574bdc5c0e9d59f237d49dcb7b92638dde146adde04bc6042",
+ "native-types": "649e978c2ccc0d4de66e2a69b8f98131015fb77c371ce4749d6278ffd84287f2",
+ "real": "8ffb0244589eff8a1d873ca6f1e1d66cc84944ab68d8bfafa118e941891ac518",
+ "strings": "c8b1aa74413d7e2a673baa27e495745b5fdf799ba423e0180620b8427cd1c42a"
+}