aboutsummaryrefslogtreecommitdiff
path: root/tests/ii/overload-functions/reference.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 10:39:45 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 10:39:45 +0000
commit4a34e970fb224be7640883f6b0dfa602157759f4 (patch)
tree3f2e0a54163b179b411e604b6362c08cb1075d3d /tests/ii/overload-functions/reference.cc
parentb47c302bbffd668334f307d512b674f804f8f2fc (diff)
test(overload): add randomized differential coverage
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/ii/overload-functions/reference.cc')
-rw-r--r--tests/ii/overload-functions/reference.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ii/overload-functions/reference.cc b/tests/ii/overload-functions/reference.cc
new file mode 100644
index 0000000..2b4b03f
--- /dev/null
+++ b/tests/ii/overload-functions/reference.cc
@@ -0,0 +1,19 @@
+#include <cstdint>
+#include <iostream>
+#include <string>
+
+int main() {
+ int count;
+ if (!(std::cin >> count)) return 1;
+ for (int row = 0; row < count; ++row) {
+ std::int64_t a, b, size, lower;
+ std::string text;
+ if (!(std::cin >> a >> b >> size >> lower >> text)) return 1;
+ // Closed forms are independent of the pseudocode's loops and dispatch.
+ const auto sum = size * a + b * size * (size - 1) / 2;
+ std::cout << 3 * a + 1 << ':' << (a < 0 ? "TRUE" : "FALSE") << ':'
+ << text.size() + 100 << ':' << 17 * a + b << ':' << sum << ':'
+ << (sum > 0 ? "TRUE" : "FALSE") << ':' << 8 * a + b << ':'
+ << 9 * a + 4 << ':' << a + b * size << ':' << a << '\n';
+ }
+}