diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-03-28 04:10:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-03-28 04:10:23 +0300 |
commit | 6ff6d6928328ff2110f028a374ade49415d5a0ba (patch) | |
tree | 4337ddc2e83368a2d606b97df08dc206e002ac67 /src/integrity_unittest.cc | |
parent | 475aea387f846561d5029807f804ff789d59e69f (diff) | |
download | manaverse-6ff6d6928328ff2110f028a374ade49415d5a0ba.tar.gz manaverse-6ff6d6928328ff2110f028a374ade49415d5a0ba.tar.bz2 manaverse-6ff6d6928328ff2110f028a374ade49415d5a0ba.tar.xz manaverse-6ff6d6928328ff2110f028a374ade49415d5a0ba.zip |
Remove physfs support.
Diffstat (limited to 'src/integrity_unittest.cc')
-rw-r--r-- | src/integrity_unittest.cc | 163 |
1 files changed, 0 insertions, 163 deletions
diff --git a/src/integrity_unittest.cc b/src/integrity_unittest.cc index fd01ce171..2d8a57a04 100644 --- a/src/integrity_unittest.cc +++ b/src/integrity_unittest.cc @@ -46,24 +46,10 @@ #include "utils/env.h" #include "utils/delete2.h" -#ifdef USE_PHYSFS -PRAGMA45(GCC diagnostic push) -PRAGMA45(GCC diagnostic ignored "-Wlong-long") -#include <physfs.h> -PRAGMA45(GCC diagnostic pop) -#endif // USE_PHYSFS #include <SDL_image.h> #include "debug.h" -#ifdef USE_SDL2 -#define PHYSFSINT int64_t -#define PHYSFSSIZE size_t -#else // USE_SDL2 -#define PHYSFSINT int32_t -#define PHYSFSSIZE int -#endif // USE_SDL2 - namespace { class InputActionSortFunctorTest final @@ -266,155 +252,6 @@ TEST_CASE("integrity tests", "integrity") VirtFs::unmountDirSilent(prefix + "data/test"); } -#ifdef USE_PHYSFS - SECTION("integrity Loader::getImage test 5") - { - VirtFs::mountZip("data/test/test.zip", Append_false); - VirtFs::mountZip("../data/test/test.zip", Append_false); - - PHYSFS_file *handle = PHYSFS_openRead(name1); - REQUIRE(handle != nullptr); -// int64_t seek = rw->seek(rw, 0, RW_SEEK_END); - const PHYSFS_sint64 len = PHYSFS_fileLength(handle); - REQUIRE(len == size1); - PHYSFSINT pos = static_cast<PHYSFSINT>(len); - REQUIRE(static_cast<PHYSFS_sint64>(pos) == len); - REQUIRE(pos >= 0); - REQUIRE(PHYSFS_seek(handle, static_cast<PHYSFS_uint64>(pos)) != 0); - int64_t seek = pos; - - REQUIRE(seek != -1); - -// const int64_t pos1 = rw->seek(rw, 0, RW_SEEK_CUR); - const PHYSFS_sint64 current = PHYSFS_tell(handle); - REQUIRE(current != -1); - REQUIRE(current == size1); - pos = CAST_S32(current); - REQUIRE(static_cast<PHYSFS_sint64>(pos) == current); - REQUIRE(PHYSFS_seek(handle, static_cast<PHYSFS_uint64>(pos)) != 0); - const int64_t pos1 = pos; - - REQUIRE(pos1 == size1); - -// seek = rw->seek(rw, 0, RW_SEEK_SET); - REQUIRE(PHYSFS_seek(handle, static_cast<PHYSFS_uint64>(0)) != 0); - seek = 0; - - REQUIRE(seek != -1); - - unsigned char buf[size1]; - -// const size_t sz = rw->read(rw, buf, 1, pos1); - const PHYSFS_sint64 rc = PHYSFS_read(handle, buf, - CAST_U32(1), - CAST_U32(size1)); - if (rc != static_cast<PHYSFS_sint64>(size1)) - { - logger->log("PHYSFS_read %d bytes", static_cast<int>(rc)); - if (!PHYSFS_eof(handle)) - { - logger->log("PhysicsFS read error: %s", - PHYSFS_getLastError()); - } -// rw->close(rw); - REQUIRE(PHYSFS_close(handle) != 0); - } - const size_t sz = rc; - REQUIRE(sz == size1); - -// rw->close(rw); - REQUIRE(PHYSFS_close(handle) != 0); - - VirtFs::unmountZip("data/test/test.zip"); - VirtFs::unmountZip("../data/test/test.zip"); - } - - SECTION("integrity Loader::getImage test 6") - { - VirtFs::mountZip("data/test/test.zip", Append_false); - VirtFs::mountZip("../data/test/test.zip", Append_false); - - PHYSFS_file *handle = PHYSFS_openRead(name1); - REQUIRE(handle != nullptr); -// int64_t seek = rw->seek(rw, 0, RW_SEEK_END); - const PHYSFS_sint64 len = PHYSFS_fileLength(handle); - PHYSFSINT pos = static_cast<PHYSFSINT>(len); - REQUIRE(static_cast<PHYSFS_sint64>(pos) == len); - REQUIRE(pos >= 0); - REQUIRE(PHYSFS_seek(handle, static_cast<PHYSFS_uint64>(pos)) != 0); - int64_t seek = pos; - - if (seek == -1) - { -// rw->close(rw); - REQUIRE(PHYSFS_close(handle) != 0); - } - REQUIRE(seek != -1); - -// const int64_t pos1 = rw->seek(rw, 0, RW_SEEK_CUR); - const PHYSFS_sint64 current = PHYSFS_tell(handle); - REQUIRE(current != -1); - pos = CAST_S32(current); - REQUIRE(static_cast<PHYSFS_sint64>(pos) == current); - REQUIRE(PHYSFS_seek(handle, static_cast<PHYSFS_uint64>(pos)) != 0); - const int64_t pos1 = pos; - - if (pos1 != size1) - { -// rw->close(rw); - REQUIRE(PHYSFS_close(handle) != 0); - } - REQUIRE(pos1 == size1); - -// seek = rw->seek(rw, 0, RW_SEEK_SET); - REQUIRE(PHYSFS_seek(handle, static_cast<PHYSFS_uint64>(0)) != 0); - seek = 0; - - if (seek == -1) - { -// rw->close(rw); - REQUIRE(PHYSFS_close(handle) != 0); - } - REQUIRE(seek != -1); - - unsigned char buf[size1]; - -// const size_t sz = rw->read(rw, buf, 1, pos1); - const PHYSFS_sint64 rc = PHYSFS_read(handle, buf, - CAST_U32(1), - CAST_U32(pos1)); - if (rc != static_cast<PHYSFS_sint64>(pos1)) - { - if (!PHYSFS_eof(handle)) - { - logger->log("PhysicsFS read error1: %s", - PHYSFS_getLastError()); - } - } - const size_t sz = rc; - - if (sz != size1) - { -// rw->close(rw); - logger->log("PhysicsFS read error2: %s", - PHYSFS_getLastError()); - REQUIRE(PHYSFS_close(handle) != 0); - } - REQUIRE(sz == size1); - -// rw->close(rw); - REQUIRE(PHYSFS_close(handle) != 0); - - VirtFs::unmountZip("data/test/test.zip"); - VirtFs::unmountZip("../data/test/test.zip"); - VirtFs::mountDirSilent("data/test", Append_true); - VirtFs::mountDirSilent("../data/test", Append_true); - REQUIRE(compareBuffers(buf)); - VirtFs::unmountDirSilent("data/test"); - VirtFs::unmountDirSilent("../data/test"); - } -#endif // USE_PHYSFS - SECTION("integrity Loader::getImage test 7") { VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); |