给出以下示例
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <stdint.h>
using namespace ::testing;
class Tested
{
public:
virtual void setArray(const uint32_t[3]) {};
};
class Tested_mock: public Tested
{
public:
MOCK_METHOD1(setArray, void(const uint32_t[3]));
};
class TestRunner: public ::testing::Test
{
public:
StrictMock<Tested_mock> t;
};
TEST_F(TestRunner, test)
{
uint32_t a[3] = {1UL, 2UL, 3UL};
EXPECT_CALL(t, setArray(_)).With(ElementsAreArray(a));
t.setArray(a);
}
我不明白为什么将参数更改为uint32_t*
时无法编译此代码段。 Gmock的固定大小数组参数是否有问题?