mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 12:08:30 +00:00
- Updated build and run commands to accept a --target option for specifying target platforms. - Enhanced documentation to include cross-compilation usage and supported targets. - Modified configuration to allow target-specific settings and toolchains. - Introduced a new test command to run project tests with specified profiles and targets. - Improved handling of target directories and output structure for different platforms. - Added support for multiple targets in the configuration file. - Implemented inheritance for workspace and dependencies based on target and profile.
1.2 KiB
1.2 KiB
dcr test
Runs the project's test suite.
Usage
dcr test
dcr test --release
dcr test --target linux
dcr test --init
What test does
- Builds the project with the specified profile/target.
- Compiles test files in
tests/(e.g.,tests/test.c) into a test binary. - Runs the test binary and parses output for PASS/SKIP/FAIL results.
- Reports summary with colored output.
Test Structure
DCR uses a simple test framework:
- Header:
tests/dcr_test.h(generated bydcr test --init) - Test file:
tests/test.c(template generated bydcr test --init) - Macros:
TEST(name),TEST_CASE(name),EXPECT(condition),SKIP(reason) - Output:
[PASS] test_name,[FAIL] test_name, or[SKIP] test_name
Config values used
package.namebuild.compiler,build.language,build.standardbuild.cflags,build.ldflagsbuild.debug/build.releasebuild.targets(if specified)
Notes
- Test binary is linked with the main project (for lib projects) or standalone.
--initcreatestests/dcr_test.handtests/test.cif missing.- Tests run in release mode by default for performance.
- Custom test logic can be added by editing
tests/test.c. - Fails if no
tests/test.cexists (rundcr test --initfirst).