blob: 3cf4525b90c4f0cdc621cbd44f625e7cb7c04bd9 [file] [log] [blame]
#include <vector>
#include <gtest/gtest.h>
#include <prjxray/xilinx/architectures.h>
#include <prjxray/xilinx/frames.h>
#include <prjxray/xilinx/xc7series/part.h>
using namespace prjxray::xilinx;
TEST(FramesTest, FillInMissingFrames) {
std::vector<xc7series::FrameAddress> test_part_addresses = {
xc7series::FrameAddress(xc7series::BlockType::CLB_IO_CLK, false, 0,
0, 0),
xc7series::FrameAddress(xc7series::BlockType::CLB_IO_CLK, false, 0,
0, 1),
xc7series::FrameAddress(xc7series::BlockType::CLB_IO_CLK, false, 0,
0, 2),
xc7series::FrameAddress(xc7series::BlockType::CLB_IO_CLK, false, 0,
0, 3),
xc7series::FrameAddress(xc7series::BlockType::CLB_IO_CLK, false, 0,
0, 4)};
xc7series::Part test_part(0x1234, test_part_addresses);
Frames<Series7> frames;
frames.getFrames().emplace(std::make_pair(
xc7series::FrameAddress(2), std::vector<uint32_t>(101, 0xCC)));
frames.getFrames().emplace(std::make_pair(
xc7series::FrameAddress(3), std::vector<uint32_t>(101, 0xDD)));
frames.getFrames().emplace(std::make_pair(
xc7series::FrameAddress(4), std::vector<uint32_t>(101, 0xEE)));
ASSERT_EQ(frames.getFrames().size(), 3);
EXPECT_EQ(frames.getFrames().at(test_part_addresses[2]),
std::vector<uint32_t>(101, 0xCC));
EXPECT_EQ(frames.getFrames().at(test_part_addresses[3]),
std::vector<uint32_t>(101, 0xDD));
EXPECT_EQ(frames.getFrames().at(test_part_addresses[4]),
std::vector<uint32_t>(101, 0xEE));
frames.addMissingFrames(test_part);
ASSERT_EQ(frames.getFrames().size(), 5);
EXPECT_EQ(frames.getFrames().at(test_part_addresses[0]),
std::vector<uint32_t>(101, 0));
EXPECT_EQ(frames.getFrames().at(test_part_addresses[1]),
std::vector<uint32_t>(101, 0));
EXPECT_EQ(frames.getFrames().at(test_part_addresses[2]),
std::vector<uint32_t>(101, 0xCC));
EXPECT_EQ(frames.getFrames().at(test_part_addresses[3]),
std::vector<uint32_t>(101, 0xDD));
EXPECT_EQ(frames.getFrames().at(test_part_addresses[4]),
std::vector<uint32_t>(101, 0xEE));
}