Skip to content

gamesun/learn-gtest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

learn-gtest

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.

the first example(/mytest)

  1. change directory to /mytest
    $ cd mytest/

  2. Compile:
    $ g++ -I./include -c A.cpp
    $ g++ -I./include -c A_test.cpp

  3. Link:
    $ g++ A.o A_test.o libgtest.a -o test

  4. Execute:
    $ ./test.exe

the second example(/mytest2)

  1. change directory
    $ cd mytest/make/

  2. Make:
    $ make

  3. Execute:
    $ ./test.exe

About

learn how to use googletest to test C language source code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published