chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes

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
    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++)
    x1 = CPU::returnintNo();//Works, X1 = 123 here
    WHEN_CALLED(CPU::returnLongNo()).Return(123); //Works
    x2 = CPU::returnLongNo();//Works, X2 = 123 here
    x3 = CPU::returnULongLongNo(); //Doesn't work here..Expected 123 but x3= 528280977531
    x4 = CPU::returnint64No(); //Doesn't work here..Expected 123 but x4=528280977531 


asked by nirmaln13 (600 points)

Please log in or register to answer this question.