lingjf / h2unit Goto Github PK
View Code? Open in Web Editor NEWLight-weight (as light as hydrogen) unit test framework for C/C++, since 2012
License: Apache License 2.0
Light-weight (as light as hydrogen) unit test framework for C/C++, since 2012
License: Apache License 2.0
Currently end-user should include two files: h2unit.cpp and h2unit.h.
If there two files can be merged into one file , it will be more simple to use.
C++ class can be wrote in header file, static member method and static variable can be used to implement global instance. I have wrote a test, it works.
The difficult is how to implement memory leak detection for C source file.
A work around is that consider C source file as C++ source file and compile with C++ compiler.
It success to dynamic stub by function pointer, but it fail to dynamic stub by function name. It can be reproduced in unit test environment.
H2CASE(dynamic_stub, "test dynamic stub local static function")
Analysis:
mprotect() failed because the address which is generated by 'nm' with the function name.
nm's output symbol address is incorrect (comparing with function pointer).
{
char* rv = NULL;
H2EQ_MATH(NULL, rv);
}
compile failed due to can't cast char* to double.
how to dump executable symbols in windows ?
PCRE is a heavy library, it can be used to provide such feature. but it will break h2unit's principle : Light-Weight just like hydrogen.
I want to write a function to implement simple regex (a subset of regex, and no consider performance)
A normal idea to replace assert() is undefine assert first, then define assert to new function. Include assert.h (cassert) before re-define assert.
But in actual, assert.h does not following #ifndef/#define/#endif mode , so the normal idea does not work.
More information refer to /user/include/assert.h
STUB/MOCK not works with xcode 11.3 toolchain, but works with xcode 10.3.
compile error message:
h2unit.cpp: In member function ‘void h2unit_case::stub(void_, void_, const char*)’:
h2unit.cpp:918: error: ‘p’ was not declared in this scope
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.