Repository navigation
Conversation
qubic-cli has no unit tests today (test_utils.* are interactive, node-connected helpers compiled into the binary). This adds a first, self-contained gtest suite for the pure input validators in sanity_check.h: isValidIpAddress plus death tests (exit code 1) for the validators that abort on bad input (sanityCheckValidAssetName, sanityCheckTxType, checkValidEpoch, sanityCheckMainAuxStatus, sanityCheckUnitofMeasurement, sanityCheckLoggingMode, sanityCheckExtraDataSize). The suite needs neither the core submodule nor the crypto/network code: it includes only sanity_check.h and provides the two symbols that header expects from its usual include context (DEFAULT_SEED and a stubbed checkSumIdentity). Tests are opt-in via -DQUBIC_CLI_BUILD_TESTS=ON (default OFF), so the normal build and existing CI are unchanged; googletest is fetched with FetchContent. cmake -DQUBIC_CLI_BUILD_TESTS=ON -S . -B build cmake --build build --target qubic-cli-tests && ctest --test-dir build 11 tests across 8 suites, all passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
qubic-cli currently has no unit tests —
test_utils.*are interactive, node-connected helpers compiled into the binary, not isolated tests. This adds a first, self-contained gtest suite for the pure input validators insanity_check.h:isValidIpAddress— accepts well-formed IPv4, rejects out-of-range/malformed;sanityCheckValidAssetName,sanityCheckTxType,checkValidEpoch,sanityCheckMainAuxStatus,sanityCheckUnitofMeasurement,sanityCheckLoggingMode,sanityCheckExtraDataSize.11 tests across 8 suites, all passing.
No heavy dependencies
The suite includes only
sanity_check.hand supplies the two symbols that header expects from its usual include context (DEFAULT_SEEDand a stubbedcheckSumIdentity), so it needs neither thecoresubmodule nor the crypto/network code — it compiles and runs on its own.Opt-in, nothing else changes
Tests are gated behind
-DQUBIC_CLI_BUILD_TESTS=ON(default OFF), so the normal build and existing CI are untouched. googletest is pulled in withFetchContent.Intended as a seed others can extend; happy to wire it into CI as a follow-up if that's wanted.