aboutsummaryrefslogtreecommitdiff
path: root/tests/ii/real/reference.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.one>2026-10-16 20:53:55 +0800
committer_ov4 <ov4@ov4.one>2026-10-16 20:53:55 +0800
commitd19f9ddb866ac2415cbfe66966897a8efe8ddb63 (patch)
tree6be1a9a6e316e776a396813f7cb22c688287b21a /tests/ii/real/reference.cc
parent5c00b8cd03cbfc516cce92229f3f4974d7549c24 (diff)
test(compiler): add seeded C++ differential tests across seven groups
Generate 10000 random records per group plus boundary inputs using a portable SHA-256 stream. Compare native and runner output independently. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'tests/ii/real/reference.cc')
-rw-r--r--tests/ii/real/reference.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ii/real/reference.cc b/tests/ii/real/reference.cc
new file mode 100644
index 0000000..4c1e118
--- /dev/null
+++ b/tests/ii/real/reference.cc
@@ -0,0 +1,15 @@
+#include <iostream>
+const char *boolean(bool value) { return value ? "TRUE" : "FALSE"; }
+int main() {
+ int count;
+ if (!(std::cin >> count)) return 1;
+ for (int i = 0; i < count; ++i) {
+ int a, b;
+ if (!(std::cin >> a >> b)) return 1;
+ double x = a / 8.0, y = b / 8.0;
+ std::cout << boolean(x < y) << ':' << boolean(x == y) << ':'
+ << boolean(2.0 * x == a / 4.0) << ':'
+ << boolean(x + y == (a + b) / 8.0) << ':'
+ << boolean(x * y == (a * b) / 64.0) << '\n';
+ }
+}