Beruflich Dokumente
Kultur Dokumente
Google Test is a unit testing library for the C++ programming language, based on
the xUnit architecture. It is a cross platform system that provides automatic test discovery.
Step 01:
Create Project (Console Application) which calculates square root of provided number:
Uncheck “Precompiled Headers” before creating project.
National University of Computer & Emerging Sciences (NUCES),
Islamabad Department of Computer Science
Link: http://www.bogotobogo.com/cplusplus/files/cpptest/gtest-1.7.0-rc1.zip
Or download from slate
The src folder has all the gtest source files and later we need to add the include directory to the
include path.
National University of Computer & Emerging Sciences (NUCES),
Islamabad Department of Computer Science
Step 03: Compile gtest into a static library (For Visual studio 2010, 2012 and 2013)
D:\Fall 2018\Gunit\gtest-1.7.0\src\gtest_all.cc
and D:\Fall 2018\Gunit\gtest-1.7.0\src\gtest_main.cc.
In the build process, we may have some errors related to class template:
VC++ 2012 does not (and will never) support variadic templates; consequently, its standard
library implementation attempts to fake them using preprocessor-generated overloads and
specializations. The number of faux variadic template parameters defaults to 5 - the problem is
that gtest is trying to instantiate std::tuple<> with as many as 10 template arguments. - Google
Test in Visual Studio 2012.
Build GoogleTest
Output:
3. This project needs additional path to the initial project (SquareRoot) which we want to
be tested.
National University of Computer & Emerging Sciences (NUCES),
Islamabad Department of Computer Science
Output:
National University of Computer & Emerging Sciences (NUCES),
Islamabad Department of Computer Science