From 4a34e970fb224be7640883f6b0dfa602157759f4 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 10:39:45 +0000 Subject: test(overload): add randomized differential coverage Co-Authored-By: Claude Opus 5.5 --- tests/ii/overload-functions/reference.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/ii/overload-functions/reference.cc (limited to 'tests/ii/overload-functions/reference.cc') 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 +#include +#include + +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'; + } +} -- cgit v1.3.1-4-g156e