C/C++ DocTest
A C/C++ DocTest that runs tests using clang-repl interaction in comments. Supports Linux (macOS is untested).
Prerequisites
clang-repl-kernelversion 0.1.8libclangmust be installed and functioning properly
Usage
sample.cpp
#include "sample.h"
namespace test {
/**
>>> test::Fac fac;
>>> %<< fac.fac(7);
5040
*/
int Fac::fac(int n) {
return (n > 1) ? n * fac(n - 1) : 1;
}
/**
>>> test::Fac fac;
>>> %<< fac.fac2(5);
120
*/
int Fac::fac2(int n) {
return (n > 1) ? n * fac(n - 1) : 1;
}
}
sample.h
#pragma once
/**
>>> test::Fac fac;
>>> %<< fac.fac(5);
120
>>> %<< fac.fac2(5);
120
*/
namespace test {
class Fac {
public:
/**
>>> test::Fac fac;
>>> %<< fac.fac(5);
120
*/
int fac(int n);
int fac2(int n);
};
}
Building the Shared Library on Linux
clang -c -o sample.o sample.cpp
clang -shared sample.o -o sample.so
Building the DLL on Windows
clang-cl -c -o sample.o sample.cpp
clang -shared sample.o -o sample.dll
Running Tests with Source Code and Shared Library on Linux
python3 -m cdoctest -cdtt=sample.h -cdtl=sample.so -cdtip=.
Running Tests with Source Code and DLL on Windows
python -m cdoctest -cdtt=sample.h -cdtl=sample.dll -cdtip=.
Support vscode extension
Can be used with vscode extension cdoctest_vscode_extension
Metadata
Release files for cdoctest 1.4.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cdoctest-1.4.20-py3-none-any.whl | Python 3 | none | any | Details for cdoctest-1.4.20-py3-none-any.whl |
Release files / cdoctest-1.4.20-py3-none-any.whl
| Download URL | cdoctest-1.4.20-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
166fdd6d2fea5bfb745ad71bc0b3733b2be14c5fbd22023d42c7665db8161fac
|
|
BLAKE2b-256 checksum How to use checksums |
877e47899fe6115482a82cf9b7f790e9d6cced114e686145e92055f9ae9f3f52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for cdoctest 1.4.20
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.