Suites combine tests with common functionality (for example, when performing different cases for the same function). It's useful to group test cases when they are logically connected or use the same data. Organizing tests in a way that the order in which you run them doesn't affect the results. Google Test V1.8.0 may also be available from the apt repository (or equivalent) for your distribtion.3 - checking the results (assertions block)Ĭreating tests for all publicly exposed functions, including class constructors and operators.Ĭovering all code paths and checking both trivial and edge cases, including those with incorrect input data (refer to negative testing).Īssuring that each test works independently and does't prevent other tests from execution. If you have compile problems involving Google Test because of the issue mentioned above you may need to uninstall it and use the first method described below. ![]() Provided it is >=V1.8.0 this is the easiest method to install Google Test. Some Linux distributions may have Google Test available to install from the distribution Software Manager, usually as shared libraries. This patch is incorporated for V3.2 forward. The changes in the patch need to be incorporated in the files ~/gnucash3.x/common/cmake-modules/GncAddTest.cmake and ~/gnucash3.x/common/test-core/CMakeLists.txt as discussed in the patch if you wish to use installed libraries. The CMake files in v3.0 or 3.1 of GnuCash were not setup to detect the presence of the installed libraries. If you have installed the shared libraries do not define GTEST_ROOT and remove any existing commands to define it from $HOME/.profile. Make # build the static and shared libraries libraries Set the switches to generate the installation scripts for makeĬmake -DCMAKE_INSTALL_PREFIX =/usr/local -DBUILD_SHARED_LIBS =ON -DBUILD_GMOCK =ON -DINSTALL_GTEST =ON -DINSTALL_GMOCK =ON. The static libraries are only built here to test the installation and are not used in practice. If you wish to place googletest elsewhere just substitute the path to your selected directory in the following. $HOME/.local/src is one possibility used here for illustration. In a terminal change directory to a suitable directory/folder in your home directory where you want to keep a local copy of googletest, e.g. They can also be built as shared libraries.Ĭompiling Google Test and Google Mock into project code (recommended method) V1.8.0 of Googletest has googlemock incorporated into it rather than as a separate library. That said GnuCash does build successfully with shared libraries. To avoid this, Google recommend building the libraries as static libraries rather than dynamic shared libraries. If Google Test and your test code have been compiled with different compiler flags and because the Google Test code contains conditional #if statements mutiple definitions may be produced. It is not generally recommended to install Google Test as shared libraries since C++ has a One Definition Rule where if two source files contain different definitions of the same class/function/variable and they are linked together the rule is violated, the linker may not detect the error and the behaviour at run time becomes unpredictable. Installing Google Test for Building Gnucash ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |