samedi 14 mai 2022

Identifier "Return" is undefined in gtest?

SPIGtestMain.cpp
#include "gtest/gtest.h"
#include "gmock/gmock.h"

TEST_F(GivenANewSPI,WhenDemoIsCalled_TheComponentGetsVal)
{
    unsigned char const *Ptr;
    unsigned char const *BufLim;

    const unsigned char *DataSample;
    const unsigned char *EndOfSample;
    
    extren MockClass MockObj;

    EXPECT_CALL(MockObj, PSDemo(Ptr,BufLim)).WillOnce(Return(25));
    EXPECT_EQ(Val,Demo(DataSample,EndOfSample);
}

MockSPI.h
#include <gmock/gmock.h>

class MockClass : public GivenANewSPI
{
    public:
        MockClass();
        ~MockClass();
    
        MOCK_METHOD2 (PSDemo,signed char(unsigned char const*,unsigned char const*));
};

SPI.h
#include "gtest/gtest_prod.h"

class SPI : public SPIProxy
{
    private:
        virtual signed char PSDemo(unsigned char const *Ptr,unsigned char const *BufLim) const;
        virtual signed char Demo(const unsigned char* DataSample, const unsigned char* EndOfSample) override;
};

I'm getting following errors,

  1. MockSPI.h: expected class name before '{' token
  2. SPIGtestMain.cpp: 'MockClass' does not name a type
  3. SPIGtestMain.cpp: 'MockObj' was not declared in this scope
  4. SPIGtestMain.cpp: 'Return' was not declared in this scope

Aucun commentaire:

Enregistrer un commentaire