1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00
openrw/tests/test_RWBStream.cpp

34 lines
847 B
C++
Raw Normal View History

#include <boost/test/unit_test.hpp>
#include <loaders/RWBinaryStream.hpp>
#include <platform/FileHandle.hpp>
#include "test_Globals.hpp"
BOOST_AUTO_TEST_SUITE(RWBStreamTests)
#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);
2016-09-09 22:13:22 +02:00
RWBStream::ChunkID id = stream.getNextChunk();
2016-09-09 22:13:22 +02:00
BOOST_REQUIRE_EQUAL(id, 0x0010);
2016-09-09 22:13:22 +02:00
auto inner = stream.getInnerStream();
2016-09-09 22:13:22 +02:00
auto inner1 = inner.getNextChunk();
2016-09-09 22:13:22 +02:00
BOOST_REQUIRE_EQUAL(inner1, 0x0001);
2016-09-09 22:13:22 +02:00
auto innerCursor = inner.getCursor();
2016-09-09 22:13:22 +02:00
// This is a value inside in the Clump's struct header section.
2018-07-27 22:53:35 +02:00
BOOST_CHECK_EQUAL(*reinterpret_cast<std::uint32_t*>(innerCursor), 0x10);
2016-09-09 22:13:22 +02:00
}
}
#endif
BOOST_AUTO_TEST_SUITE_END()