#include "flash-ipmi.hpp"
#include "ipmi.hpp"
#include "updater_mock.hpp"

#include <cstring>

#include <gtest/gtest.h>

using ::testing::ElementsAreArray;
using ::testing::Return;
using ::testing::StrictMock;

// ipmid.hpp isn't installed where we can grab it and this value is per BMC
// SoC.
#define MAX_IPMI_BUFFER 64

TEST(IpmiFlashData, DataReceivedIsPassedOnOk)
{
    // If valid data was passed in, it'll pass it onto the update handler.

    StrictMock<UpdaterMock> updater;

    size_t dataLen;
    uint8_t request[MAX_IPMI_BUFFER] = {0};
    uint8_t reply[MAX_IPMI_BUFFER] = {0};

    struct ChunkHdr tx;
    tx.cmd = FlashSubCmds::flashDataBlock;
    tx.offset = 0x00;
    std::memcpy(request, &tx, sizeof(tx));

    uint8_t bytes[] = {0x04, 0x05};
    std::memcpy(&request[sizeof(struct ChunkHdr)], bytes, sizeof(bytes));

    dataLen = sizeof(struct ChunkHdr) + sizeof(bytes);

    EXPECT_CALL(updater,
                flashData(0x00, ElementsAreArray(bytes, sizeof(bytes))))
        .WillOnce(Return(true));

    EXPECT_EQ(IPMI_CC_OK, dataBlock(&updater, request, reply, &dataLen));
    EXPECT_EQ(sizeof(uint8_t), dataLen);
    EXPECT_EQ(0, reply[0]);
}
