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
0 votes

Hi, I've been exploring Isolator++ for the past few weeks and I've come across an issue with faking virtual functions that are templated. Here's some test code that I added to the Isolator++ examples to reproduce the problem:



#pragma once
template <class V>
class MyClass {
public:
    V* testType(V p) { return nullptr; };
    virtual int testVirtual() = 0;
};
TEST_METHOD(MyTest) {
    MyClass<Person>* fake = FAKE<MyClass<Person>>();
    Person* f = FAKE<Person>();
    WHEN_CALLED(fake->testType(*f)).Return(f); // <- Works fine
    WHEN_CALLED(fake->testVirtual()).Return(5); // <- Crash
}

The above test will work fine if testVirtual is not faked. As soon as you attempt to fake testVirtual the program will have a SEH crash (access memory violation).

Isolator++ version 4.1.1.24

Visual Studio 2019 version 16.3.9

MSVC version 14.23.28105

asked by Fadorico (600 points)

1 Answer

0 votes
Thanks for reporting this - it is a bug
We will fix it.
In the meantime you can fake a specific implentation when the function is not pure
answered by eli (5.7k points)
...