edge-llm-cpp-test
Skill631 starsChanged 3 days agoApache-2.0View on GitHub
Write or change a C++ test under unittests/. Covers the BDD comment contract, mutation testing, and the substitute engines that drive LLMInferenceRuntime without a serialized engine. Apply whenever adding, migrating, or repairing a GTest case in this repository.
In this repository16 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- edge-llm-accuracy-debuggingSkill
- edge-llm-add-modelSkill
- edge-llm-benchmark-accuracySkill
- edge-llm-benchmark-performanceSkill
- edge-llm-convert-modelSkill
- edge-llm-cutedsl-kernelSkill
- edge-llm-documentationSkill
- edge-llm-e2e-testSkill
- edge-llm-feature-combinationsSkill
- edge-llm-few-layer-testSkill
- edge-llm-installSkill
- edge-llm-plugin-extensionSkill
- edge-llm-serveSkill
- edge-llm-version-migrationSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
Run the full group before reporting, not just your filter: a substitute or fixture shared with other suites can break them.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --><!-- SPDX-License-Identifier: Apache-2.0 -->EdgeLLM C++ Tests
C++ tests live in unittests/. Build them with -DBUILD_UNIT_TESTS=ON; they need a GPU but no model files.
Non-negotiable
- Every test case carries a Given/When/Then comment. That comment is the specification. The test body is one rendering of it.
- Every new assertion is mutation-tested, and the mutation is confirmed to have changed the observed value before any conclusion is drawn from it.
- Writing or changing a Given/When/Then comment is a human decision. Propose it; do not decide it.
The reasoning behind all three, and the failure modes they exist to prevent, is in references/test-discipline.md. Read it before writing a test.
Workflow
- State the behavior you intend to protect as Given/When/Then, in plain language, before writing any assertion. If you cannot state it without describing the implementation, you do not yet know what the test is for.
- Render assertions from that statement. Prefer asserting the observable consequence over the bookkeeping that reports it — see "Assert the work, not the accounting" in the discipline reference.
- For runtime tests, assemble
LLMInferenceRuntimearound a substitute engine rather than a serialized engine. Which substitute, and how to observe through it, is inreferences/runtime-test-infra.md. For EAGLE or MTP draft substitutes, useFakeEngineExecutor::actAsDraftEngine()ormakeLogProbDraftEngine(): draft logits must be log-probabilities, unlike a base engine's raw logits. - Build and run:
cmake --build build --target unitTestRuntime -j$(nproc) export LD_LIBRARY_PATH=$TRT_PACKAGE_DIR/lib:$LD_LIBRARY_PATH ./build/unittests/unitTestRuntime --gtest_filter="YourSuite.*" - Mutation-test each new assertion, then revert the mutation and re-run the whole target to confirm the tree is clean.
- Run the full group before reporting, not just your filter: a substitute or fixture shared with other suites can break them.
When a test fails
Only two responses are legitimate: fix the production code so it satisfies the Given/When/Then, or establish that the Given/When/Then itself is wrong — which needs a human. Re-rendering the test so it passes while the comment stays put is not a third option.
References
| File | Read when |
references/test-discipline.md | Before writing or changing any test |
references/runtime-test-infra.md | Writing a test that drives LLMInferenceRuntime |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

