main不会调用gtest的测试源

时间:2015-12-07 08:02:41

标签: c++ eclipse googletest

我正在尝试运行我为我的程序编写的Google测试测试。 但是主要没有调用那些源文件。

任何想法?

这是我的主要内容:

#include "gtest.h"
#include <iostream>
#include "System.h"

GTEST_API_ int main(int argc, char **argv){

    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
    //System s;
}

这是我的一项测试:

#include "gtest.h"
#include "Movie.h"
#include <iostream>
#include <algorithm>

Movie *firstMovie = new Movie("03205", "The Great Movie", "one of the best movies ever",
                        8.9, 1995, 125);
Movie *secondMovie = new Movie("0245", "new Movie", "an ok movie", 7, 2001, 135);
Movie *thirdMovie = new Movie("02451", "new Movie2", "a good movie", 3, 2022, 79);

/*
 * this function checks the unity of the names.
 */
TEST(TestMovie1,checkNames) {

    cout<<firstMovie->GetName();
    cout<<secondMovie->GetName();
    cout<<thirdMovie->GetName();

    EXPECT_NE(firstMovie->GetName(), secondMovie->GetName());
    EXPECT_NE(firstMovie->GetName(), thirdMovie->GetName());
    EXPECT_NE(thirdMovie->GetName(), secondMovie->GetName());
}

非常感谢。

0 个答案:

没有答案