19 #include <boost/test/unit_test.hpp>
26 #include <boost/filesystem.hpp>
31 BOOST_AUTO_TEST_SUITE(regression)
32 BOOST_AUTO_TEST_SUITE(bitstream)
44 std::fstream fileStream(referencePath.string().c_str(), std::ios::binary | std::ios::in);
45 std::cerr <<
"Trying to read: " << referencePath << std::endl;
46 BOOST_REQUIRE(fileStream.good());
48 bitstream.
read(fileStream,
false);
54 uint16_t stdFrameLength = 65;
55 uint16_t ioFrameLength = 0;
56 uint32_t wordCount = 0;
57 Spartan6::iterator p = bitstream.begin();
58 Spartan6::iterator e = bitstream.end();
67 if(packet.
getHeader() == writeFLRHeader) {
68 ioFrameLength = packet[1] + 1;
69 std::cout << inDeviceName <<
" IO frame length: " << ioFrameLength << std::endl;
71 }
else if(packet.
getHeader() == writeFDRIHeader) {
74 boost::shared_array<uint16_t> words = packet.
getWords();
75 std::cout << inDeviceName <<
" FDRI word count: " << wordCount << std::endl;
76 std::cout << inDeviceName <<
" stdandard words: " << (wordCount - ioFrameLength)
84 size_t end = wordCount - ioFrameLength - stdFrameLength;
86 words[pos] = ~words[pos];
87 pos += (stdFrameLength << 1);
92 std::fstream outputStream(generatedPathOdd.string().c_str(),
93 std::ios::binary | std::ios::out);
94 BOOST_REQUIRE(outputStream.good());
95 bitstream.write(outputStream);
104 size_t end = wordCount - ioFrameLength - stdFrameLength;
106 words[pos] = ~words[pos];
107 pos += stdFrameLength;
112 std::fstream outputStream(generatedPathEven.string().c_str(),
113 std::ios::binary | std::ios::out);
114 BOOST_REQUIRE(outputStream.good());
115 bitstream.write(outputStream);
116 outputStream.flush();
128 BOOST_REQUIRE(
false);
131 int& argc = boost::unit_test::framework::master_test_suite().argc;
132 char**& argv = boost::unit_test::framework::master_test_suite().argv;
134 BOOST_REQUIRE(argc >= 1);
141 torc::common::DeviceVector::const_iterator dp = devices.begin();
142 torc::common::DeviceVector::const_iterator de = devices.end();
145 if(device.empty())
break;
156 int& argc = boost::unit_test::framework::master_test_suite().argc;
157 char**& argv = boost::unit_test::framework::master_test_suite().argv;
159 BOOST_REQUIRE(argc >= 1);
166 /
"torc" /
"bitstream" /
"regression";
172 std::fstream fileStream(referencePathOdd.string().c_str(), std::ios::binary | std::ios::in);
173 std::cerr <<
"Trying to read: " << referencePathOdd << std::endl;
174 BOOST_REQUIRE(fileStream.good());
176 bitstream.
read(fileStream,
false);
178 std::cout << bitstream << std::endl;
183 std::fstream fileStream(referencePathEven.string().c_str(), std::ios::binary | std::ios::in);
184 std::cerr <<
"Trying to read: " << referencePathEven << std::endl;
185 BOOST_REQUIRE(fileStream.good());
187 bitstream.
read(fileStream,
false);
189 std::cout << bitstream << std::endl;
194 BOOST_AUTO_TEST_SUITE_END()
195 BOOST_AUTO_TEST_SUITE_END()
uint16_t getHeader(void) const
uint32_t getWordCount(void) const
Returns the number of payload words in the packet, excluding the header word.
static const DeviceVector & getSpartan6Devices(void)
Returns the Spartan6 devices.
Header for the DirectoryTree class.
void buildSpartan6Partials(const std::string &inDeviceName, const boost::filesystem::path &inWorkingPath)
const WordSharedArray getWords(void) const
brief Returns the raw packet words, including the header word.
Bitstream packet for Spartan 16 bit class architectures.
static uint16_t makeHeader(EPacketType inType, EOpcode inOpcode, uint16_t inAddress, uint32_t inCount)
Construct a packet header.
Header for the Spartan6 class.
Header for the Spartan6BuildHelper class.
Encapsulation of filesystem paths that are used by the library.
Header for the Devices class.
boost::filesystem::path path
static const boost::filesystem::path & getWorkingPath(void)
Returns the absolute path to the working directory.
BOOST_AUTO_TEST_CASE(hexCharacterToDec)
std::vector< std::string > DeviceVector
Vector of device names.
virtual void read(std::istream &inStream, bool inCleanDateAndTime=true)
Read the bitstream header and packets from a stream.