Hello,

i am currently checking if isolator++ would be capable to test some parts of our legacy code. I came across a function which has 15 arguments and i am having trouble to test this.

I created a small example which is reproducing the issue, at least in my setup

#include <gtest/gtest.h>

#include <Isolator.h>

#include <iostream>

class ExampleTest : public ::testing::Test {

public:

virtual void TearDown() {

ISOLATOR_CLEANUP();

}

};

namespace NS1 {

int calctest(int &i1, bool &b1, int &i2, bool &b2, bool &b3, bool &b4);

int calctest2(int &i1, bool &b1, int &i2, bool &b2, bool &b3, bool &b4, bool &b5);

}

int NS1::calctest(int &i1, bool &b1, int &i2, bool &b2, bool &b3, bool &b4) {

return 1;

}

int NS1::calctest2(int &i1, bool &b1, int &i2, bool &b2, bool &b3, bool &b4, bool &b5) {

return 1;

}

static int fakedCalctest(int &i1, bool &b1, int &i2, bool &b2, bool &b3, bool &b4) {

std::cout << "&i1:" << &i1 << " &i2:" << &i2 << " &b1:" << &b1 << " &b2:" << &b2 << " &b3:" << &b3 << " &b4:" << &b4

<< std::endl;

return 2;

}

static int fakedCalctest2(int &i1, bool &b1, int &i2, bool &b2, bool &b3, bool &b4, bool &b5) {

std::cout << "&i1:" << &i1 << " &i2:" << &i2 << " &b1:" << &b1 << " &b2:" << &b2 << " &b3:" << &b3 << " &b4:" << &b4

<< " &b5:" << &b5 << std::endl;

return 2;

}

class calcClass {

private:

int doAction(int aid, int &apl);

};

int calcClass::doAction(int aid, int &apl) {

int res = 0, i1 = -1, i2 = -1;

bool b1 = false, b2 = false, b3 = false, b4 = false, b5 = false;

std::cout << "&i1:" << &i1 << " &i2:" << &i2 << " &b1:" << &b1 << " &b2:" << &b2 << " &b3:" << &b3 << " &b4:" << &b4

<< " &b5:" << &b5 << std::endl;

// res = NS1::calctest(i1, b1, i2, b2, b3, b4); // this works fine

res = NS1::calctest2(i1, b1, i2, b2, b3, b4, b5); // this is making problems

return res;

}

TEST_F(ExampleTest, FirstTest) {

WHEN_CALLED(NS1::calctest(ANY_REF(int), ANY_REF(bool), ANY_REF(int), ANY_REF(bool), ANY_REF(bool), ANY_REF(bool)))

.DoStaticOrGlobalInstead(fakedCalctest, NULL);

WHEN_CALLED(NS1::calctest2(ANY_REF(int), ANY_REF(bool), ANY_REF(int), ANY_REF(bool), ANY_REF(bool), ANY_REF(bool), ANY_REF(bool)))

.DoStaticOrGlobalInstead(fakedCalctest2, NULL);

int retVar = -999, aid = 0, apl = 1;

calcClass *mcalcClass = new calcClass();

ISOLATOR_INVOKE_FUNCTION(retVar, mcalcClass, doAction, aid, &apl);

EXPECT_EQ(retVar, 2);

}

the two outputs are delivering:

&i1:0x7ffce37e1cdc &i2:0x7ffce37e1ce0 &b1:0x7ffce37e1cd7 &b2:0x7ffce37e1cd8 &b3:0x7ffce37e1cd9 &b4:0x7ffce37e1cda &b5:0x7ffce37e1cdb

&i1:0x7ffce37e1cdc &i2:0x7ffce37e1ce0 &b1:0x7ffce37e1cd7 &b2:0x7ffce37e1cd8 &b3:0x7ffce37e1cd9 &b4:0x7ffce37e1cda &b5:0x7ffce37e1a00

for me it seems like there is a wrong address for b5 delivered to fakedCalctest2 which is making problems if you want to manipulate this value.

Is it possible that this problem only appears when the amount of arguments is higher than 6? Because the fakedCalctest with 6 and less arguments are working like intendent and fakedCalctest2 with 7 (or 15) arguments not. Or am i doing something wrong?

Thank you very much!