mirror of https://github.com/openXC7/prjxray.git
xc7series: add unit test for addMissingFrames
Signed-off-by: Tomasz Michalak <tmichalak@antmicro.com>
This commit is contained in:
parent
1f6ba5d734
commit
cbc58c9ad1
|
|
@ -58,7 +58,8 @@ if (PRJXRAY_BUILD_TESTING)
|
|||
xilinx/xc7series/frame_address_test.cc
|
||||
xilinx/xc7series/global_clock_region_test.cc
|
||||
xilinx/xc7series/part_test.cc
|
||||
xilinx/xc7series/row_test.cc)
|
||||
xilinx/xc7series/row_test.cc
|
||||
xilinx/xc7series/frames_test.cc)
|
||||
target_link_libraries(xilinx_xc7series_test libprjxray gtest_main)
|
||||
add_test(NAME xilinx_xc7series_test
|
||||
COMMAND xilinx_xc7series_test
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <prjxray/xilinx/xc7series/frames.h>
|
||||
#include <prjxray/xilinx/xc7series/part.h>
|
||||
|
||||
namespace xc7series = prjxray::xilinx::xc7series;
|
||||
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);
|
||||
|
||||
xc7series::Frames 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));
|
||||
}
|
||||
Loading…
Reference in New Issue