Setting up GoogleTest
Before we start writing any unit tests, we must have the GoogleTest library installed, and the process to do so is outlined below. As of July 8, 2023, the automated scripts will install GoogleTest-v1.13.0.
Should you need the library’s source code, you can find it here:
GitHub - google/googletest: GoogleTest - Google Testing and Mocking Framework
Prerequisites
To properly use the install scripts, you will need the following tools:
Git
CMake
C++ compiler
On Windows, you need to download all three. For the C++ compiler, it is recommended you choose MinGW.
On Linux or MacOS, you likely only need Git and CMake as your system probably comes with a C++ compiler built in.
Install Scripts
Three bash scripts, which automatically install GoogleTest, are provided. Download the one appropriate for your OS, and place it wherever you want.
For Windows, execute the script in a GitBash terminal which was run as administrator.
For Linux or MacOS, execute the script in whatever terminal you please.