mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 09:00:04 +00:00
Basic parsing for Archive II file
This commit is contained in:
parent
59d06a8632
commit
33c114ee9d
14 changed files with 412 additions and 1 deletions
2
test/CMakeLists.txt
Normal file
2
test/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
cmake_minimum_required(VERSION 3.11)
|
||||
include(test.cmake)
|
||||
1
test/data
Submodule
1
test/data
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 40f68fe08977e5168679ce0419834312a6369205
|
||||
33
test/source/scwx/util/rangebuf.test.cpp
Normal file
33
test/source/scwx/util/rangebuf.test.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include <scwx/util/rangebuf.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <boost/iostreams/copy.hpp>
|
||||
#include <boost/iostreams/filtering_streambuf.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
|
||||
TEST(rangebuf, smiles_mile)
|
||||
{
|
||||
std::istringstream iss("smiles");
|
||||
iss.seekg(1);
|
||||
util::rangebuf rb(iss.rdbuf(), 4);
|
||||
|
||||
std::ostringstream oss;
|
||||
|
||||
boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
|
||||
in.push(rb);
|
||||
|
||||
std::streamsize bytesCopied = boost::iostreams::copy(in, oss);
|
||||
std::string substring {oss.str()};
|
||||
|
||||
EXPECT_EQ(substring, "mile");
|
||||
EXPECT_EQ(bytesCopied, 4);
|
||||
EXPECT_EQ(iss.tellg(), 5);
|
||||
EXPECT_EQ(iss.eof(), false);
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace scwx
|
||||
26
test/source/scwx/wsr88d/rpg/ar2v_file.test.cpp
Normal file
26
test/source/scwx/wsr88d/rpg/ar2v_file.test.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include <scwx/wsr88d/rpg/ar2v_file.hpp>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
{
|
||||
namespace rpg
|
||||
{
|
||||
|
||||
TEST(ar2v_file, klsx)
|
||||
{
|
||||
Ar2vFile file;
|
||||
bool fileValid =
|
||||
file.LoadFile(std::string(SCWX_TEST_DATA_DIR) +
|
||||
"/nexrad/level2/Level2_KLSX_20210527_1757.ar2v");
|
||||
|
||||
EXPECT_EQ(fileValid, true);
|
||||
}
|
||||
|
||||
} // namespace rpg
|
||||
} // namespace wsr88d
|
||||
} // namespace scwx
|
||||
7
test/source/scwx/wxtest.cpp
Normal file
7
test/source/scwx/wxtest.cpp
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
44
test/test.cmake
Normal file
44
test/test.cmake
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
cmake_minimum_required(VERSION 3.11)
|
||||
project(scwx-test CXX)
|
||||
|
||||
include(GoogleTest)
|
||||
|
||||
find_package(Boost)
|
||||
find_package(BZip2)
|
||||
find_package(GTest)
|
||||
|
||||
set(SRC_MAIN source/scwx/wxtest.cpp)
|
||||
set(SRC_UTIL_TESTS source/scwx/util/rangebuf.test.cpp)
|
||||
set(SRC_WSR88D_RPG_TESTS source/scwx/wsr88d/rpg/ar2v_file.test.cpp)
|
||||
|
||||
add_executable(wxtest ${SRC_MAIN}
|
||||
${SRC_UTIL_TESTS}
|
||||
${SRC_WSR88D_RPG_TESTS})
|
||||
|
||||
source_group("Source Files\\main" FILES ${SRC_MAIN})
|
||||
source_group("Source Files\\util" FILES ${SRC_UTIL_TESTS})
|
||||
source_group("Source Files\\wsr88d\\rpg" FILES ${SRC_WSR88D_RPG_TESTS})
|
||||
|
||||
target_include_directories(wxtest PRIVATE ${GTest_INCLUDE_DIRS})
|
||||
|
||||
set_target_properties(wxtest PROPERTIES CXX_STANDARD 17
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF)
|
||||
|
||||
if (MSVC)
|
||||
set_target_properties(wxtest PROPERTIES LINK_FLAGS "/ignore:4099")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(wxtest PRIVATE SCWX_TEST_DATA_DIR="${SCWX_DIR}/test/data")
|
||||
|
||||
gtest_discover_tests(wxtest)
|
||||
|
||||
target_link_libraries(wxtest Boost::iostreams
|
||||
Boost::log
|
||||
BZip2::BZip2
|
||||
GTest::gtest
|
||||
wxdata)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(wxtest Ws2_32)
|
||||
endif()
|
||||
Loading…
Add table
Add a link
Reference in a new issue