sinojelly / mockcpp

Two C/C++ testing tools, mockcpp and testngpp.
Apache License 2.0
67 stars 42 forks source link

how to use checkWith? #11

Closed GoogleCodeExporter closed 3 years ago

GoogleCodeExporter commented 9 years ago
the source code is:
bool checkGlobalEnable(void* vpIn)
{
    mux_switch_conf_t* pMux = (mux_switch_conf_t*)vpIn;
    return (MUX_ENABLE == pMux->arg) ? true : false;
}

MOCKER(msMux_IoCtrl)
        .expects(once())
            .with(eq(IOCTRL_CLASS_MSAN_SWITCH_INTF), eq(DRV_SET_DHCP_EN), checkWith(checkGlobalEnable), any(), any())
            .will(returnValue(0));

then compiled in vs2005 failed:
using native typeof
1>c:\syy\mockcpp\include\mockcpp\chainingmockhelper.h(103) : error C2825: 
'Predict': must be a class or namespace when followed by '::'
1>        
e:\testngpp\myprj\nppkt\nppkt\unittest\testcase\test_nppkt_pktctrl.h(53) : see 
reference to function template instantiation 'mockcpp::Constraint 
*mockcpp::checkWith<int(__cdecl *)(void *)>(Predict)' being compiled
1>        with
1>        [
1>            Predict=int (__cdecl *)(void *)
1>        ]
1>c:\syy\mockcpp\include\mockcpp\chainingmockhelper.h(103) : error C2039: '()' 
: is not a member of '`global namespace''
1>c:\syy\mockcpp\include\mockcpp\chainingmockhelper.h(103) : error C2275: 
'Predict' : illegal use of this type as an expression
1>        
e:\testngpp\myprj\nppkt\nppkt\unittest\testcase\test_nppkt_pktctrl.h(53) : see 
declaration of 'Predict'
1>c:\syy\mockcpp\include\mockcpp\chainingmockhelper.h(103) : error C2275: 
'Predict' : illegal use of this type as an expression

Original issue reported on code.google.com by call...@gmail.com on 12 Oct 2012 at 4:12

sinojelly commented 3 years ago

这个编译环境比较老了,而且mockcpp版本也有更新。请在新版本尝试。