g++ -o main *.o -I./include -L./gtest/lib -lgtest -lpthread
最后生成main文件。
复制代码
运行测试
运行生成的可执行文件main
./main
1
2
3
运行结果如下:
[==========] Running 1 test from 1 test case.
[———-] Global test environment set-up.
[———-] 1 test from two_sum_test
[ RUN ] two_sum_test.twoSum001
numsSize=4
[ OK ] two_sum_test.twoSum001 (0 ms)
[———-] 1 test from two_sum_test (0 ms total)
[———-] Global test environment tear-down
[==========] 1 test from 1 test case ran. (0 ms total)
[ PASSED ] 1 test.