2014-08-04 23:21:01 +02:00
|
|
|
#include <boost/test/unit_test.hpp>
|
2016-04-15 02:06:10 +02:00
|
|
|
#include <loaders/RWBinaryStream.hpp>
|
2017-10-30 23:44:40 +01:00
|
|
|
#include <platform/FileHandle.hpp>
|
2017-10-26 03:51:24 +02:00
|
|
|
#include "test_Globals.hpp"
|
2014-08-04 23:21:01 +02:00
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE(RWBStreamTests)
|
|
|
|
|
2016-06-16 22:11:55 +02:00
|
|
|
#if RW_TEST_WITH_DATA
|
2016-09-09 22:13:22 +02:00
|
|
|
BOOST_AUTO_TEST_CASE(iterate_stream_test) {
|
|
|
|
{
|
|
|
|
auto d = Global::get().e->data->index.openFile("landstal.dff");
|
|
|
|
|
|
|
|
RWBStream stream(d->data, d->length);
|
|
|
|
|
|
|
|
RWBStream::ChunkID id = stream.getNextChunk();
|
2014-08-04 23:21:01 +02:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
BOOST_REQUIRE_EQUAL(id, 0x0010);
|
2014-08-04 23:21:01 +02:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
auto inner = stream.getInnerStream();
|
2014-08-04 23:21:01 +02:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
auto inner1 = inner.getNextChunk();
|
2014-08-04 23:21:01 +02:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
BOOST_REQUIRE_EQUAL(inner1, 0x0001);
|
2014-08-04 23:21:01 +02:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
auto innerCursor = inner.getCursor();
|
2014-08-04 23:21:01 +02:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
// This is a value inside in the Clump's struct header section.
|
|
|
|
BOOST_CHECK_EQUAL(*(std::uint32_t*)innerCursor, 0x10);
|
|
|
|
}
|
2014-08-04 23:21:01 +02:00
|
|
|
}
|
2016-06-16 22:11:55 +02:00
|
|
|
#endif
|
2014-08-04 23:21:01 +02:00
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|