I have been trying to use the assertion of ASSERT_EQ and EXPECT_EQ,
ASSERT_EQ(queue_->size(),6);
even using this
ASSERT_EQ(6,6);
However, I encountered this compiler error and everywhere I searched no one seems to be facing this problem.
/tmp/cczZfMaq.o: In function testing::AssertionResult testing::internal::EqHelper<false>::Compare<char, char>(char const*, char const*, char const&, char const&)':
/usr/include/gtest/gtest.h:1485: undefined reference to
testing::AssertionResult testing::internal::CmpHelperEQ(char const*, char const*, char const&, char const&)' collect2: error: ld returned 1 exit status make: * [priority_queue_test.out] Error 1
Full Test File :
//Include the class which you would like to test #include "priority_queue.h" //Include the google c++ test framework #include #include #include //use the namespace for the testing class using namespace algorithms; using namespace containers; namespace{ //Test Fixture Class //multple tests in a test case shared common objects and subroutines class PriorityQueueTest : public ::testing::Test{ protected: PriorityQueueTest(){ } virtual ~PriorityQueueTest(){ } virtual void SetUp(){ queue_ = new PriorityQueue(1000); } virtual void TearDown(){ } PriorityQueue *queue_=NULL; }; TEST_F(PriorityQueueTest,CheckAllMemberInitSuccessfully){ //ASSERT is a critcal assertion which will fail the test program ASSERT_TRUE(queue_!=NULL) capacity()==1000) capacity(); } TEST_F(PriorityQueueTest,CheckIfItemsAreEnqueueCorrectly){ //test cases queue_->Enqueue(0,0); queue_->Enqueue(1,1); queue_->Enqueue(6,6); queue_->Enqueue(5,5); queue_->Enqueue(3,3); queue_->Enqueue(2,2); ASSERT_EQ('a','a'); } }//namespace int main(int argc, char *argv[]){ ::testing::InitGoogleTest(&argc,argv); return RUN_ALL_TESTS(); }
I have been trying to use the assertion of ASSERT_EQ and EXPECT_EQ,
ASSERT_EQ(queue_->size(),6);
even using this
ASSERT_EQ(6,6);
However, I encountered this compiler error and everywhere I searched no one seems to be facing this problem.
/tmp/cczZfMaq.o: In function
testing::AssertionResult testing::internal::EqHelper<false>::Compare<char, char>(char const*, char const*, char const&, char const&)': /usr/include/gtest/gtest.h:1485: undefined reference to
testing::AssertionResult testing::internal::CmpHelperEQ(char const*, char const*, char const&, char const&)' collect2: error: ld returned 1 exit status make: * [priority_queue_test.out] Error 1
--
---
You received this message because you are subscribed to the Google Groups "Google C++ Testing Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googletestframe...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
To unsubscribe from this group and stop receiving emails from it, send an email to googletestframework+unsub...@googlegroups.com.