I am experiencing a weird behaviour with c++ static methods related to Typemock faking functionality, I see incorrect values returned from the fakes depending upon the datatype returned from the static method.
The faking functionality works for a c++ static method only if the return type was simple like int or long datatype.
It doesn't work if the return type was __int64 or ULONGLONG. can someone please help me with this?
I am using VC 2013 with Typemock Isolator ++ for C++ (version 3.5)
Class under test
class CPU
{
public:
static int returnintNo();
static long returnLongNo();
static __int64 returnint64No();
static ULONGLONG returnULongLongNo();
}
int CPU::returnintNo()
{
int x = 10;
return x;
}
long CPU::returnLongNo(){
long x = 10;
return x;
}
__int64 CPU::returnint64No(){
__int64 x = 10;
return x;
}
ULONGLONG CPU::returnULongLongNo(){
ULONGLONG x = 10;
return x;
}
Test class (Google Test with Typemock for C++)
WHEN_CALLED(CPU::returnintNo()).Return(123);
x1 = CPU::returnintNo();//Works, X1 = 123 here
WHEN_CALLED(CPU::returnLongNo()).Return(123); //Works
x2 = CPU::returnLongNo();//Works, X2 = 123 here
WHEN_CALLED(CPU::returnULongLongNo()).Return(123);
x3 = CPU::returnULongLongNo(); //Doesn't work here..Expected 123 but x3= 528280977531
WHEN_CALLED(CPU::returnint64No()).Return(123);
x4 = CPU::returnint64No(); //Doesn't work here..Expected 123 but x4=528280977531
thanks
Nirmal