#include #include #include #include #include namespace xc7series = prjxray::xilinx::xc7series; TEST(ConfigurationColumnTest, IsValidFrameAddress) { xc7series::ConfigurationColumn column(10); // Inside this column. EXPECT_TRUE(column.IsValidFrameAddress(xc7series::FrameAddress( xc7series::BlockType::CLB_IO_CLK, false, 1, 2, 3))); // Past this column's frame width. EXPECT_FALSE(column.IsValidFrameAddress(xc7series::FrameAddress( xc7series::BlockType::CLB_IO_CLK, false, 1, 2, 10))); } TEST(ConfigurationColumnTest, GetNextFrameAddressYieldNextAddressInColumn) { xc7series::ConfigurationColumn column(10); auto next_address = column.GetNextFrameAddress(xc7series::FrameAddress( xc7series::BlockType::CLB_IO_CLK, false, 1, 2, 3)); EXPECT_TRUE(next_address); EXPECT_EQ(*next_address, xc7series::FrameAddress(xc7series::BlockType::CLB_IO_CLK, false, 1, 2, 4)); } TEST(ConfigurationColumnTest, GetNextFrameAddressYieldNothingAtEndOfColumn) { xc7series::ConfigurationColumn column(10); EXPECT_FALSE(column.GetNextFrameAddress(xc7series::FrameAddress( xc7series::BlockType::CLB_IO_CLK, false, 1, 2, 9))); } TEST(ConfigurationColumnTest, GetNextFrameAddressYieldNothingOutsideColumn) { xc7series::ConfigurationColumn column(10); // Just past last frame in column. EXPECT_FALSE(column.GetNextFrameAddress(xc7series::FrameAddress( xc7series::BlockType::CLB_IO_CLK, false, 1, 2, 10))); } TEST(ConfigurationColumnTest, YamlEncodeTest) { xc7series::ConfigurationColumn column(10); YAML::Node node(column); EXPECT_TRUE(node["frame_count"]); EXPECT_EQ(node["frame_count"].as(), 10); } TEST(ConfigurationColumnTest, YAMLDecodeTest) { YAML::Node node; node.SetTag("xilinx/xc7series/configuration_column"); node["frame_count"] = 10; auto column = node.as(); EXPECT_TRUE(column.GetNextFrameAddress(xc7series::FrameAddress( xc7series::BlockType::CLB_IO_CLK, false, 1, 2, 8))); EXPECT_FALSE(column.GetNextFrameAddress(xc7series::FrameAddress( xc7series::BlockType::CLB_IO_CLK, false, 1, 2, 9))); }