coolxv / cpp-stub

C++ unit test stub(not mock) and awesome.Surpported ISA x86,x86-64,arm64,arm32,arm thumb,mips64,riscv,loongarch64.
MIT License
280 stars 82 forks source link

overloaded template functions? #5

Closed brjoha closed 5 years ago

brjoha commented 5 years ago

Given these static template functions...

template void foo(int) {}

template<typename X, typename Y> void foo(int, int, int) {}

Is it possible to stub this? The examples show a class template function, but not a standalone template function.

brjoha commented 5 years ago

Got it...

stub.set((void(*)(int))(&foo<X>), foo_stub_1);
stub.set((void(*)(int, int, int))(&foo<X, Y), foo_stub_3);