Abstract:In C++, test code is often interwoven with the unit we want to test. During the test development process we often have to modify the public interface of a class to replace existing dependencies; e.g. a supplementary setter or constructor function is added for dependency injection. In many cases, extra template parameters are used for the same purpose. All existing solutions have serious detrimental effects on the code structure and sometimes on the run-time performance as well. In this paper, we overview exist… Show more
“…Compared to existing compile-time instrumentation solutions, our technique does not require the modification or even the recompilation of the intercepted functions, which is a possible advantage in case of legacy code, system libraries, third-party shared libraries or in situations when we have to avoid library interposing. We have created a prototype implementation using the LLVM/Clang compiler infrastructure, which is publicly available at [14].…”
Section: Discussionmentioning
confidence: 99%
“…These replacement functions behave as a proxy; they forward each function call on a given Turtle instance to a corresponding test double (lines [17][18][19][20][21][22]. The way we get the reference for a relevant test double is pretty simple in this test: we return a reference to a static instance of the MockTurtle class (lines [12][13][14][15]. We can use this simplification because we know that there is only one Turtle object over the lifetime of our test-case.…”
Section: Figure 25: a Legacy Graphics Programmentioning
confidence: 99%
“…Next, we set up the architecture dependent function pointer adjustment (line 10). Then, we get the offset and return with the appropriate element in the vtable (lines [11][12]. We could replace virtual functions by exploiting this technique.…”
Section: Runtime Librarymentioning
confidence: 99%
“…Values of this type may be pointers to any int data member of the class A. Once we get the pointer to the member in line 13, we can bind this pointer to an object, and this way, we get a reference to the data member (in line 14).…”
Section: Access Via Explicit Instantiationmentioning
confidence: 99%
“…We bind the result of get() function to the object of the class, and then we return with a reference to the resulting member. Later, (in lines [13][14][15][16][17][18][19] we add another overload that handles the cases where the object is bound to a const lvalue reference. In this case, we would like to preserve the constness of the object, therefore we should return with a const reference to the member.…”
Of course, thanks to all the people who advised me with their technical expertise. My special thanks go to Zoltán Porkoláb for his counsel, ideas and all those hours he has spent with the reviews. In addition, thanks to my colleges,
“…Compared to existing compile-time instrumentation solutions, our technique does not require the modification or even the recompilation of the intercepted functions, which is a possible advantage in case of legacy code, system libraries, third-party shared libraries or in situations when we have to avoid library interposing. We have created a prototype implementation using the LLVM/Clang compiler infrastructure, which is publicly available at [14].…”
Section: Discussionmentioning
confidence: 99%
“…These replacement functions behave as a proxy; they forward each function call on a given Turtle instance to a corresponding test double (lines [17][18][19][20][21][22]. The way we get the reference for a relevant test double is pretty simple in this test: we return a reference to a static instance of the MockTurtle class (lines [12][13][14][15]. We can use this simplification because we know that there is only one Turtle object over the lifetime of our test-case.…”
Section: Figure 25: a Legacy Graphics Programmentioning
confidence: 99%
“…Next, we set up the architecture dependent function pointer adjustment (line 10). Then, we get the offset and return with the appropriate element in the vtable (lines [11][12]. We could replace virtual functions by exploiting this technique.…”
Section: Runtime Librarymentioning
confidence: 99%
“…Values of this type may be pointers to any int data member of the class A. Once we get the pointer to the member in line 13, we can bind this pointer to an object, and this way, we get a reference to the data member (in line 14).…”
Section: Access Via Explicit Instantiationmentioning
confidence: 99%
“…We bind the result of get() function to the object of the class, and then we return with a reference to the resulting member. Later, (in lines [13][14][15][16][17][18][19] we add another overload that handles the cases where the object is bound to a const lvalue reference. In this case, we would like to preserve the constness of the object, therefore we should return with a const reference to the member.…”
Of course, thanks to all the people who advised me with their technical expertise. My special thanks go to Zoltán Porkoláb for his counsel, ideas and all those hours he has spent with the reviews. In addition, thanks to my colleges,
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.