Files
msime-windows/server/tests
Evan Hu 60fce0f043 Merge branch main into feat/generic-pinyin-order-correction
唯一冲突是 engine 子模块指针,取 main 的当前值(其中已含本 PR 依赖的
MSIME-Engine#1,以及后续的 #20 门控修复)。
2026-09-05 23:34:30 +09:00
..
2026-06-20 22:11:00 +08:00
2025-05-30 23:03:58 +08:00
2026-06-20 22:11:00 +08:00
2025-04-20 17:44:33 +08:00
2026-06-20 22:11:00 +08:00
2025-04-20 17:44:33 +08:00
2025-04-21 18:32:45 +08:00

Tests

This project now includes a lightweight regression test target wired into the main CMake build.

What It Covers

Current tests focus on high-value IME behaviors that are easy to accidentally break during refactors:

  • shuangpin scheme request construction
  • quanpin scheme request construction
  • case-preserving shuangpin segmentation
  • full-helpcode detection
  • engine + shuangpin continuation behavior
  • cloud suggestion trigger timing for shuangpin

The goal is not to fully simulate the whole IME UI pipeline yet. The goal is to protect the core input rules and session behavior.

Build The Tests

From the repository root:

cmake --build build --config Debug --target MetasequoiaImeServerTests

Run The Tests

Recommended:

ctest --test-dir build -C Debug --output-on-failure

You can also run from inside the build directory:

cd build
ctest -C Debug --output-on-failure

Common Pitfall

If you run ctest from the source root directly, you may see:

No tests were found!!!

That usually means ctest is looking at the source directory instead of the build directory.

Use one of these instead:

ctest --test-dir build -C Debug --output-on-failure

or

cd build
ctest -C Debug --output-on-failure

Test Layout

  • tests/src/main.cpp
    • tiny custom test runner
  • tests/includes/test_framework.h
    • lightweight assertion helpers
  • tests/src/test_shuangpin_scheme.cpp
    • shuangpin scheme unit tests
  • tests/src/test_quanpin_scheme.cpp
    • quanpin scheme unit tests
  • tests/src/test_shuangpin_query.cpp
    • query/helper function tests
  • tests/src/test_engine_shuangpin_session.cpp
    • session-level behavior tests

When you change input behavior, add a regression test if the change affects:

  • input segmentation
  • space/enter/backspace behavior
  • helpcode handling
  • continuation after candidate selection
  • create-word flow
  • cloud suggestion timing

The best tests in this project are the ones that capture a concrete input example that previously broke.