#include "flash-ipmi.hpp"

#include <cstdio>
#include <cstring>
#include <gtest/gtest.h>
#include <string>
#include <vector>

#define THIRTYTWO_MIB 33554432

class FlashIpmiFlashDataTest : public ::testing::Test
{
  protected:
    FlashIpmiFlashDataTest() = default;

    void SetUp() override
    {
        name = std::tmpnam(nullptr);
    }
    void TearDown() override
    {
        (void)std::remove(name.c_str());
    }

    std::string name;
};

TEST_F(FlashIpmiFlashDataTest, CalledOutOfSequenceFails)
{
    // Verify that there is sanity checking
    std::vector<uint8_t> bytes = {0xaa, 0x55};

    FlashUpdate updater(name);
    EXPECT_FALSE(updater.flashFinish());

    // Verify the file doesn't exist.
    auto file = std::fopen(name.c_str(), "r");
    EXPECT_FALSE(file);
}

TEST_F(FlashIpmiFlashDataTest, CalledInSequenceSucceeds)
{
    // Verify that under normal usage it closes the file.
    std::vector<uint8_t> bytes = {0xaa, 0x55};

    FlashUpdate updater(name);
    updater.start(THIRTYTWO_MIB);
    EXPECT_TRUE(updater.flashFinish());

    // Verify we can open the file, so we know it didn't get deleted.
    auto file = std::fopen(name.c_str(), "r");
    EXPECT_TRUE(file);
    std::fclose(file);
}

TEST_F(FlashIpmiFlashDataTest, CalledTwiceFails)
{
    // Verify that under normal usage it closes the file, and therefore cannot
    // be closed twice.
    std::vector<uint8_t> bytes = {0xaa, 0x55};

    FlashUpdate updater(name);
    updater.start(THIRTYTWO_MIB);
    EXPECT_TRUE(updater.flashFinish());

    EXPECT_FALSE(updater.flashFinish());

    // Verify we can open the file, so we know it didn't get deleted.
    auto file = std::fopen(name.c_str(), "r");
    EXPECT_TRUE(file);
    std::fclose(file);
}
