cpp-stub
cpp-stub copied to clipboard
C++ unit test stub(not mock) and awesome.Surpported ISA x86,x86-64,arm64,arm32,arm thumb,mips64,riscv,loongarch64.
https://download.copr.fedorainfracloud.org/results/jdanek/skupper-router/fedora-rawhide-aarch64/03820885-skupper-router/builder-live.log.gz ``` /builddir/build/BUILD/skupper-router/tests/cpp-stub/cpp_stub.h:47:11: error: 'uint32_t' was not declared in this scope 47 | ((uint32_t*)fn)[0] = 0x58000040 | 9;\ | ^~~~~~~~ /builddir/build/BUILD/skupper-router/tests/cpp-stub/cpp_stub.h:248:13: note: in expansion of macro 'REPLACE_FAR' 248 | REPLACE_FAR(this,...
I am using `void Stub::set` to install my stub. The program crashes when compiled in GCC with Thread Sanitizer. ``` ThreadSanitizer:DEADLYSIGNAL ==4759==ERROR: ThreadSanitizer: SEGV on unknown address 0x000000001297 (pc 0x7f5971a10868...
The original function can't reenter after stub.reset when running the compiled elf with valgrind, the reason is valgrind has translated the function code after stub and saved to its code...
Hello, I did some translation for zh, and would like make following changes for README_zh.md diff in following link; [README_zh.md.txt](https://github.com/coolxv/cpp-stub/files/7190893/README_zh.md.txt) Thanks, Mark
I am using amd64 architecture. I enabled AddressSanitizer and UndefinedBehavior sanitizer in GCC. My tests produce the following undefined behavior error: ``` cpp_stub.h:244:13: runtime error: store to misaligned address 0x0000004bc2e1...
here is an eg: template class Foo { void foo(X x,Y y) {} }; how to stub for foo(X x,Y y) method?
核心思想就是为lambda表达式生成独一无二的类和执行函数。 ```cpp #include #include #include "cpp_stub/stub.h" /*** * FakeFunction 可以封装一个函数或lambda表达式,用于替换目标函数。 * 需要注意的是模板参数中的N和S,对于同一个测试用例中的FakeFunction,一定不能有相同的N、S组合。 * 如果测试用例中只有一个FakeFunction或传入的函数声明都不相同时,可以省略N或S。 * 如果想要通过某个类型区分FakeFunction,请设置模板参数S。 * * 使用示例: * auto fun = []() { prstd::size_tf("hehe\n"); }; * FakeFunction fl(fun);...
In the following example, test_stub will not be called. But test_stub will be call when fun1 and fun2 are in two diff files. main.c: int test_stub(int a){ return 0; }...
The dependent submodule [injectorpp](https://github.com/mazong1123/injectorpp.git ) is not accessible now.