The main function
To run the tests, Google Test requires a main function that initializes the Google Test framework and runs all the tests. Here’s an example:
#include <gtest/gtest.h>
int main(int argc, char **argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}
This main function initializes Google Test, passing the command-line arguments to it, which allows for controlling test execution from the command line. RUN_ALL_TESTS() runs all the tests that have been defined and returns 0 if all tests pass or 1 otherwise.
By following these examples and explanations, you can start using Google Test to write comprehensive tests for your C++ projects, ensuring that your code behaves as expected across a wide range of scenarios.