天天看點

Centos下配置單元測試工具gtest

配置過程如下:

1、解壓gtest-1.6.0

Centos下配置單元測試工具gtest

2、檢視檔案内容,找到make檔案,進行make,生成一個測試程式,包含gtest_main.a檔案

Centos下配置單元測試工具gtest

3、測試程式運作如下:

Centos下配置單元測試工具gtest

4、建立一個檔案夾,gtest_program,将gtest-1.6.0中的include檔案拷過來。

Centos下配置單元測試工具gtest

5、在gtest_program中建立一個lib檔案夾,将gtest-1.60中的make檔案夾中新生成的gtest_main.a檔案拷貝過來。

Centos下配置單元測試工具gtest

6、編寫makefile,一定要記得修改gtest_dir為自己的路徑名。如下:

Centos下配置單元測試工具gtest
Centos下配置單元測試工具gtest

7、測試結果如下:

Centos下配置單元測試工具gtest