learn how to use googletest to test C language source code.
$ cd gtest-1.6.0/
$ g++ -I./include -I./ -c ./src/gtest-all.cc
$ g++ -I./include -I./ -c ./src/gtest_main.cc
$ ar -rv libgtest.a gtest-all.o gtest_main.o
then copy the libgtest.a
file and the include
folder under gtest-1.6.0/ to your project's directory.
-
change directory to /mytest
$ cd mytest/
-
Compile:
$ g++ -I./include -c A.cpp
$ g++ -I./include -c A_test.cpp
-
Link:
$ g++ A.o A_test.o libgtest.a -o test
-
Execute:
$ ./test.exe
-
change directory
$ cd mytest/make/
-
Make:
$ make
-
Execute:
$ ./test.exe