cd EpicChainCpp
mkdir build
cd build
cmake ..
make./tests/epicchaincpp_testsThe test suite is organized into the following categories:
- Base58: Base58 and Base58Check encoding/decoding
- Base64: Base64 encoding/decoding with URL-safe character support
- ECKeyPair: Elliptic curve key pair generation and operations
- ECPoint: EC point validation and compression
- ECDSASignature: Digital signature operations
- Hash: SHA256, RIPEMD160, and combined hashing
- XEP2: XEP-2 encryption/decryption for private keys
- ScryptParams: Scrypt parameter validation
- Sign: Signing and verification operations
- WIF: Wallet Import Format encoding/decoding
- BinaryReader: Binary deserialization
- BinaryWriter: Binary serialization
- Transaction: Transaction creation and serialization
- Signer: Transaction signer operations
- Witness: Transaction witness handling
- Hash160: 160-bit hash operations
- Hash256: 256-bit hash operations
- Address: EpicChain address encoding/decoding
- Hex: Hexadecimal encoding/decoding
- Account: Account creation and management
- Wallet: Wallet operations
./tests/epicchaincpp_tests "XEP2*" # Run all XEP2 tests
./tests/epicchaincpp_tests "ECKeyPair*" # Run all ECKeyPair tests./tests/epicchaincpp_tests --success # Show all test results including passes./tests/epicchaincpp_tests --durations yes # Show test execution times./tests/epicchaincpp_tests --list-testsCurrent test suite statistics:
- Total Test Cases: 30
- Total Test Sections: 63
- Total Assertions: 692
- Pass Rate: 100%
- Private/public key generation
- ECDSA signing and verification
- XEP-2 encryption/decryption
- WIF encoding/decoding
- Hash functions (SHA256, RIPEMD160)
- Base58/Base58Check
- Base64 (including URL-safe variants)
- Hexadecimal
- EpicChain addresses
- Binary serialization/deserialization
- Variable-length integer encoding
- Transaction serialization
- Transaction creation
- Script building
- Address generation
- Wallet management
To run tests in CI/CD pipeline:
#!/bin/bash
set -e
# Build
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
# Test
./tests/epicchaincpp_tests --reporter junit --out test-results.xml
# Check results
if [ $? -eq 0 ]; then
echo "All tests passed!"
else
echo "Tests failed!"
exit 1
fiTests use the Catch2 framework. To add a new test:
- Create a test file in the appropriate directory under
tests/ - Include the Catch2 header:
#include <catch2/catch_test_macros.hpp>
- Write your test cases:
TEST_CASE("Feature description", "[category]") { SECTION("Test scenario") { // Test code REQUIRE(actual == expected); } }
- Add the test file to
tests/CMakeLists.txt
./tests/epicchaincpp_tests --success --reporter consolegdb ./tests/epicchaincpp_tests
(gdb) run "TestName"cmake .. -DCMAKE_CXX_FLAGS="-fsanitize=address -fsanitize=undefined"
make
./tests/epicchaincpp_testsTo check test performance:
./tests/epicchaincpp_tests --durations yes --order randThis will show execution time for each test and run them in random order to detect order-dependent issues.
- OpenSSL 3.0+ shows deprecation warnings for some EC operations
- Some compiler warnings about signed/unsigned comparisons (non-critical)
Test vectors are embedded in the test files and include:
- Known good WIF encodings
- Valid XEP-2 encrypted keys
- Bitcoin/EpicChain address formats
- ECDSA signature test vectors
All test data has been verified against the EpicChain specification.