Files
msime-windows/server/tests
Jia Sui bfd42d314e feat(quanpin): wire up typing autocorrect config and tests
- config.toml [quanpin] autocorrect = true (default on)
- ime_config: GetConfiguredQuanpinAutocorrectEnabled /
  SetConfiguredQuanpinAutocorrectEnabled with template-preserving write
- engine_input_session injects the flag into the engine session
- tests: autocorrect table integrity, autocorrect_cut units, dictionary-level
  corrected-candidate-first behavior, legacy behavior when disabled, and
  cache isolation for plain spellings
- bump MetasequoiaImeEngine to 2422fd1
2026-08-31 16:01:25 +08: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.