1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 11:22:45 +01:00
openrw/tests/test_archive.cpp

31 lines
708 B
C++
Raw Normal View History

2014-02-10 13:09:16 +01:00
#include <boost/test/unit_test.hpp>
#include "test_globals.hpp"
#include <loaders/LoaderIMG.hpp>
BOOST_AUTO_TEST_SUITE(ArchiveTests)
BOOST_AUTO_TEST_CASE(test_open_archive)
{
2014-06-04 07:02:41 +02:00
LoaderIMG archive;
2014-02-10 13:09:16 +01:00
2014-06-04 07:02:41 +02:00
BOOST_REQUIRE( archive.load(Global::getGamePath() + "/models/gta3") );
2014-02-10 13:09:16 +01:00
2014-06-04 07:02:41 +02:00
BOOST_CHECK( archive.getAssetCount() > 0 );
2014-02-10 13:09:16 +01:00
2014-06-04 07:02:41 +02:00
auto& f = archive.getAssetInfoByIndex(0);
2014-02-10 13:09:16 +01:00
// A few assumptions..
BOOST_CHECK_EQUAL( f.name, "radar00.txd" );
BOOST_CHECK_EQUAL( f.offset, 0);
BOOST_CHECK_EQUAL( f.size, 33);
2014-06-04 07:02:41 +02:00
auto& f2 = archive.getAssetInfo("radar00.txd");
2014-02-10 13:09:16 +01:00
BOOST_CHECK_EQUAL( f2.name, f.name );
BOOST_CHECK_EQUAL( f2.offset, f.offset );
BOOST_CHECK_EQUAL( f2.size, f.size );
}
BOOST_AUTO_TEST_SUITE_END()