spiegel-keyman/core/tests/unit/ldml
Eberhard Beilharz 88f6c95803
fix(core): allow to successfully build on Ubuntu 24.04
Without this change trying to build on Ubuntu 24.04 fails with
"error: 'intptr_t' has not been declared in '::'". I'm not sure
why that is happening, but this is an easy fix.
2024-07-04 13:07:10 +02:00
..
invalid-keyboards chore(common): cleanup meson deprecations and warnings 2024-05-24 08:46:52 +07:00
keyboards chore(common): cleanup meson deprecations and warnings 2024-05-24 08:46:52 +07:00
core_ldml_min.cpp test(core): fix a type conversion issue in the minimal test 2024-06-14 09:05:50 -05:00
ldml.cpp chore(core): refactor to move most normalization calls into util_normalize.cpp 2024-05-23 14:47:38 -05:00
ldml_test_source.cpp feat(core): add a KMN_NO_ICU internal switch to start being able to turn off ICU 2024-05-24 09:24:53 -05:00
ldml_test_source.hpp fix(core): update ldml test source to handle reset 2024-04-05 13:22:47 -05:00
ldml_test_utils.cpp chore(linux): Rename namespace kbp to core 2023-10-19 10:39:55 +02:00
ldml_test_utils.hpp refactor(core): split context API from Core primary API 2024-01-17 14:44:25 +11:00
meson.build Merge branch 'master' into test/core/10968-minimum-ldml-test 2024-06-14 09:33:29 -05:00
README.md feat(core): ldml unit tests and stub actions 2022-08-07 08:02:50 -05:00
test_context_normalization.cpp chore(core): km_core_cp -> km_core_cu 2024-05-02 17:39:15 -05:00
test_kmx_plus.cpp fix(core): allow to successfully build on Ubuntu 24.04 2024-07-04 13:07:10 +02:00
test_transforms.cpp feat(core): devolve regex to JS 2024-06-07 18:11:20 -05:00
test_unicode.cpp feat(core): generator in core/src for util_normalize_table.h 2024-06-05 15:47:20 -05:00
write_node_versions.js fix(core): add a test to verify ICU and Unicode version 2024-05-23 09:31:15 -05:00

LDML unit tests

This directory contains unit tests that test the LDML keyboard processing.

The driver (ldml.cpp) loads and executes the tests. Each test consist of a Keyman keyboard source file (*.xml) and the compiled KMXPlus keyboard. The source file contains rules and defines the setup, input and expected results.

Defining tests in the .xml file

Somewhere near the top of the file, an XML comment contains lines that define the setup, input and expected results.

Setup

  • description: this is just for commenting what we test here
@@description: Tests Caps Lock env set
  • capsLock: allows to set the caps lock state. The example below turns caps-lock on at the start of the test. [K_CAPS] in the keys comment allows toggling of caps lock.
@@capsLock: 1
  • context: allows to setup a string which serves as context
@@context:

Input

  • keys: defines one or more virtual keys that will be processed one after the other
@@keys: [K_1][K_CAPS][K_2][SHIFT K_3][K_4][K_CAPS][K_5][K_CAPS][K_6]

Expected Result

  • expected: the resulting string of processing the input keys. In the example below each key press is expected to output the string 'pass.'.
@@expected: pass.pass.pass.pass.pass.pass.

Running the tests

All tests can be run at once with ./build.sh --debug tests.

Alternatively it's possible to run a single test with:

cd core
build/arch/debug/tests/unit/ldml/ldml 'tests/unit/ldml/000_test_zero.xml' 'tests/unit/ldml/000_test_zero.kmx'