From 80b914b33bcccab57bf8e625ea969bae0c63aa94 Mon Sep 17 00:00:00 2001 From: retoor Date: Sun, 25 Oct 2026 01:48:56 +0200 Subject: [PATCH] mplex: core test links all real sources, add mplex_core_run.sh Co-Authored-By: Claude Sonnet 5.5 --- taicpp/tests/mplex_core_run.sh | 9 +++++++++ taicpp/tests/mplex_core_test.cpp | 29 ----------------------------- 2 files changed, 9 insertions(+), 29 deletions(-) create mode 100755 taicpp/tests/mplex_core_run.sh diff --git a/taicpp/tests/mplex_core_run.sh b/taicpp/tests/mplex_core_run.sh new file mode 100755 index 0000000..b125bce --- /dev/null +++ b/taicpp/tests/mplex_core_run.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Regenerate the expected values from ../tai.py, build the core test against ALL real sources +# (src/mplex/*.cpp and src/plexer/plexer_flow.cpp) into build/, and run it. Make free. +set -e +cd "$(dirname "$0")/.." +mkdir -p build +python3 -I tests/mplex_core_gen.py +g++ -std=c++23 -Wall -Wextra -O1 -Isrc/mplex -Isrc/plexer tests/mplex_core_test.cpp src/mplex/*.cpp src/plexer/plexer_flow.cpp -o build/mplex_core_test +build/mplex_core_test diff --git a/taicpp/tests/mplex_core_test.cpp b/taicpp/tests/mplex_core_test.cpp index c2f902b..2883373 100644 --- a/taicpp/tests/mplex_core_test.cpp +++ b/taicpp/tests/mplex_core_test.cpp @@ -22,35 +22,6 @@ using namespace detz::mplex; -// ---- stand-ins for classes other forks own (only what the layout needs) ---------------- -// MplexPane / MplexVtScreen construction is stubbed so this test links without the pty code. -MplexVtScreen::MplexVtScreen(int r, int c) : rows(r), cols(c) {} -MplexPane::MplexPane(int ident, int cols, int rows, int, const std::string&, const std::string&) - : id(ident), w(std::max(1, cols)), h(std::max(1, rows)), screen(std::max(1, rows), std::max(1, cols)), created(0) {} -MplexPane::~MplexPane() {} - -// MplexCommands::resolve is another fork's; when its object is not linked this transcription -// (tai.py:15430) stands in so MplexConfig can be exercised. -__attribute__((weak)) std::string MplexCommands::resolve(const std::string& word) { - if (mplex_find_spec(word)) return word; - for (const auto& spec : mplex_command_specs()) - for (const auto& alias : spec.aliases) - if (alias == word) return spec.name; - for (const auto& name : mplex_unsupported()) - if (name == word) throw MplexError("command not supported by mplex: " + word); - std::vector matches; - for (const auto& spec : mplex_command_specs()) - if (spec.name.compare(0, word.size(), word) == 0) matches.push_back(spec.name); - if (matches.size() == 1) return matches[0]; - if (matches.size() > 1) { - std::sort(matches.begin(), matches.end()); - std::string list; - for (size_t i = 0; i < matches.size() && i < 5; ++i) list += (i ? ", " : "") + matches[i]; - throw MplexError("ambiguous command: " + word + " (" + list + ")"); - } - throw MplexError("unknown command: " + word); -} - namespace { long failures = 0, checks = 0, known_deviations = 0;