jjzjj

TheGameShow

全部标签

c++ - GoogleTest 无法使用自定义比较运算符

我想在GoogleTest中对我的Word结构进行简单测试。为了使测试代码更简单和更短,我决定编写一个比较运算符(尽管我并不真的需要一个)并且只使用ASSERT_EQ,根据theprimer.尽管一切看起来都很好,但我收到编译器错误:/*Word.h*/namespacetgs{structWord{//somethinghereWord();virtual~Word();booloperator==(Word&rhs);};}/*Word.cpp*/namespacetgs{boolWord::operator==(Word&rhs){returntrue;//thereareact