From d19f9ddb866ac2415cbfe66966897a8efe8ddb63 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 16 Oct 2026 20:53:55 +0800 Subject: 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 --- tests/ii/strings/reference.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/ii/strings/reference.cc (limited to 'tests/ii/strings/reference.cc') diff --git a/tests/ii/strings/reference.cc b/tests/ii/strings/reference.cc new file mode 100644 index 0000000..54d6efc --- /dev/null +++ b/tests/ii/strings/reference.cc @@ -0,0 +1,20 @@ +#include +#include +#include +#include +int main() { + int count; + if (!(std::cin >> count)) return 1; + for (int i = 0; i < count; ++i) { + int empty, start, width; + std::string text; + if (!(std::cin >> empty >> text >> start >> width)) return 1; + if (empty) text.clear(); + auto lower = text, upper = text; + for (auto &c : lower) c = static_cast(std::tolower(static_cast(c))); + for (auto &c : upper) c = static_cast(std::toupper(static_cast(c))); + auto mid = text.substr(static_cast(start - 1), static_cast(width)); + auto right = text.substr(text.size() - static_cast(width)); + std::cout << text.size() << ':' << mid << ':' << right << ":TRUE:" << lower << ':' << upper << '\n'; + } +} -- cgit v1.3.1-4-g156e