ฉันมีโปรเจ็กต์ C++ ที่จะประกอบด้วยการทดสอบของ Google เท่านั้น โปรเจ็กต์นี้อ้างอิงถึงโปรเจ็กต์อื่น (โปรเจ็กต์ที่กำลังทดสอบ) ฉันมีโฟลเดอร์รวมและซอร์สสำหรับส่วนหัวและไฟล์การใช้งาน ฉันกำลังสร้างคลาสการทดสอบการแข่งขันของ Google และแยกส่วนหัวและการนำไปใช้งานลงในโฟลเดอร์รวมและซอร์ส ฉันมี main.cpp ที่มีรหัสต่อไปนี้:
//main.cpp
#include "../inc/zeroEstimatorTest.h"
#include "gtest/gtest.h"
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
ปัญหาที่ฉันมีคือการเรียก RUN_ALL_TESTS()
ไม่ได้เรียกโปรแกรมทดสอบ Google ของฉัน ฟิกซ์เจอร์ทดสอบอยู่ในการใช้งานของคลาสการทดสอบ ดูเหมือนว่านี้:
//zeroEstimatorTest.cpp
class zeroEstimatorTest : public ::testing:Test
{
...
};
TEST_F(zeroEstimatorTest, zeroTest)
{
...
}
โครงการสร้างและรัน แต่ผลลัพธ์เป็นดังนี้:
[0;32m[==========] [mRunning 0 tests from 0 test cases.
[0;32m[==========] [m0 tests from 0 test cases ran. (0 ms total)
[0;32m[ PASSED ] [m0 tests.
ขณะนี้ฉันใช้ Eclipse (เป็นครั้งแรก) และใช้เครื่อง Linux 64
สิ่งที่ฉันได้ทำ:
- คลาส zeroEstimatorTest มี
"zeroEstimatorTest.h"
ที่ด้านบนสุด #include "gtest/gtest.h"
อยู่ที่ด้านบนสุดของทั้งสามไฟล์ (main.cpp, zeroEstimatorTest.h และ zeroEstimatorTest.cpp)
ใครสามารถช่วยได้บ้าง?
ขอบคุณมาก!