Skip to content

Commit 4ead632

Browse files
fix: update TFW, throw exception in McRegionWorldIo instead of returning nullptr, and bump Lodestone.Minecraft.Java version
1 parent 3718fb6 commit 4ead632

8 files changed

Lines changed: 44 additions & 32 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ add_subdirectory(projects/Converters)
2525
add_custom_target(Lodestone.All ALL DEPENDS
2626
Lodestone.Libraries
2727
Lodestone.Converters
28-
# Lodestone.Utilities
28+
Lodestone.Utilities
2929
)
3030

3131

projects/Converters/Minecraft/Java/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION VERSION 3.30)
2-
project(Lodestone.Minecraft.Java VERSION 1.2.2)
2+
project(Lodestone.Minecraft.Java VERSION 1.2.3)
33
set(PROJECT_VERSION_DEV) # used for dev versions, otherwise blank
44

55
set(CMAKE_CXX_STANDARD 20)

projects/Converters/Minecraft/Java/src/mcregion/world/McRegionWorldIo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace lodestone::minecraft::java::mcregion::world {
3333
std::unique_ptr<lodestone::level::world::World> McRegionWorldIo::read(const common::conversion::io::options::OptionPresets::CommonFilesystemOptions &options)
3434
const {
3535
if (!std::filesystem::exists(options.path))
36-
return nullptr;
36+
throw std::system_error(std::make_error_code(std::errc::no_such_file_or_directory), options.path);
3737

3838
map_t<int, std::filesystem::path> dims;
3939
dims.emplace(0, options.path); // main dim

projects/Utilities/CMakeLists.txt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
cmake_minimum_required(VERSION 3.30)
22
project(Lodestone.Utilities VERSION 1.0.2)
33

4+
set(LODESTONE_UTILITIES_PROJECTS )
5+
46
# PROJECTS
57
option(LODESTONE_UTILITIES_BUILD_TESTS "Build Lodestone.Tests" ON)
68

7-
if (LODESTONE_UTILITIES_BUILD_TESTS)
9+
#if (LODESTONE_UTILITIES_BUILD_TESTS)
810
add_subdirectory(Tests)
9-
endif()
11+
list(APPEND LODESTONE_UTILITIES_PROJECTS
12+
Lodestone.Tests
13+
)
14+
#endif()
1015

1116
unset(LODESTONE_UTILITIES_BUILD_TESTS CACHE)
1217

1318
if (BUILD_VIEWER STREQUAL "ON")
1419
add_subdirectory(Viewer)
20+
list(APPEND LODESTONE_UTILITIES_PROJECTS
21+
Lodestone.Viewer
22+
)
1523
endif()
1624

17-
#add_custom_target(Lodestone.Utilities ALL DEPENDS
18-
# Lodestone.Tests
19-
#)
25+
message(STATUS "Lodestone.Utilities: ${LODESTONE_UTILITIES_PROJECTS}")
26+
add_custom_target(Lodestone.Utilities ALL DEPENDS
27+
${LODESTONE_UTILITIES_BUILD_TESTS}
28+
)

projects/Utilities/Tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ include(FetchContent)
3131
FetchContent_Declare(
3232
tfw
3333
GIT_REPOSITORY https://codeberg.org/Dexrn/tfw.git
34-
GIT_TAG 1.0.3
34+
GIT_TAG 1.2.0
3535
GIT_SHALLOW TRUE
3636
)
3737
FetchContent_MakeAvailable(tfw)

projects/Utilities/Tests/include/Lodestone.Tests/tests/MainTests.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ namespace lodestone::tests::test {
1111
public:
1212
static void add();
1313

14-
static tfw::test::result::TestResult generateWaterChunk(tfw::test::util::TestOutputLogger &logger);
14+
static tfw::test::result::TestResult generateWaterChunk(tfw::test::logging::loggers::ITestLogger &logger);
1515

16-
static tfw::test::result::TestResult readAnvilWorld(tfw::test::util::TestOutputLogger &logger);
16+
static tfw::test::result::TestResult readAnvilWorld(tfw::test::logging::loggers::ITestLogger &logger);
1717

18-
static tfw::test::result::TestResult writeAnvilWorld(tfw::test::util::TestOutputLogger &logger);
18+
static tfw::test::result::TestResult writeAnvilWorld(tfw::test::logging::loggers::ITestLogger &logger);
1919

20-
static void readMcrChunk(tfw::test::util::TestOutputLogger &logger);
20+
static void readMcrChunk(tfw::test::logging::loggers::ITestLogger &logger);
2121

22-
static void readMcrFile(tfw::test::util::TestOutputLogger &logger);
22+
static void readMcrFile(tfw::test::logging::loggers::ITestLogger &logger);
2323

24-
static void readMcrWorld(tfw::test::util::TestOutputLogger &logger);
24+
static void readMcrWorld(tfw::test::logging::loggers::ITestLogger &logger);
2525

26-
static void readMinev2World(tfw::test::util::TestOutputLogger &logger);
26+
static void readMinev2World(tfw::test::logging::loggers::ITestLogger &logger);
2727

28-
static void readAlphaWorld(tfw::test::util::TestOutputLogger &logger);
28+
static void readAlphaWorld(tfw::test::logging::loggers::ITestLogger &logger);
2929

30-
static void writeAlphaWorld(tfw::test::util::TestOutputLogger &logger);
30+
static void writeAlphaWorld(tfw::test::logging::loggers::ITestLogger &logger);
3131
};
3232
} // namespace lodestone::tests::test
3333

projects/Utilities/Tests/src/LodestoneTests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,11 @@ int main(int argc, char **argv) {
366366
std::filesystem::create_directories(lodestone::tests::util::INPUT_FOLDER);
367367
std::filesystem::create_directories(lodestone::tests::util::OUTPUT_FOLDER);
368368

369+
auto tfw = tfw::TestFramework::initFromArgs(argc, argv);
370+
369371
ADD_TESTS(RUN_MAIN_TESTS, lodestone::tests::test::MainTests::add);
370372

371-
tfw::TestFramework::getInstance()->run();
373+
tfw->run();
372374

373375
return 0;
374376
};

projects/Utilities/Tests/src/tests/MainTests.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <fstream>
1212

1313
#include "Lodestone.Tests/util.h"
14-
#include <TestFramework/test/ComparableTest.h>
1514

1615
#include <Lodestone.Level/Level.h>
1716
#include <Lodestone.Minecraft.Java/Identifiers.h>
@@ -33,9 +32,11 @@
3332

3433
namespace lodestone::tests::test {
3534
void MainTests::add() {
36-
tfw::TestFramework::getInstance()->addTest(GENERATE_WATER_CHUNK, "Generate LCE Water Chunk", generateWaterChunk);
37-
tfw::TestFramework::getInstance()->addTest(READ_ANVIL_WORLD, "Read Anvil World", readAnvilWorld);
38-
tfw::TestFramework::getInstance()->addTest(WRITE_ANVIL_WORLD, "Write Anvil World", writeAnvilWorld);
35+
auto &mgr = tfw::TestFramework::getInstance()->testManager();
36+
37+
mgr.addTest(GENERATE_WATER_CHUNK, "Generate LCE Water Chunk", generateWaterChunk);
38+
mgr.addTest(READ_ANVIL_WORLD, "Read Anvil World", readAnvilWorld);
39+
mgr.addTest(WRITE_ANVIL_WORLD, "Write Anvil World", writeAnvilWorld);
3940
// ADD_TEST(READ_MCR_CHUNK, readMcrChunk, util::types::MAIN,
4041
// "Read McRegion Chunk");
4142
// ADD_TEST(READ_MCR_FILE, readMcrFile, util::types::MAIN,
@@ -50,7 +51,7 @@ namespace lodestone::tests::test {
5051
// "Write Alpha World");
5152
}
5253

53-
tfw::test::result::TestResult MainTests::generateWaterChunk(tfw::test::util::TestOutputLogger &logger) {
54+
tfw::test::result::TestResult MainTests::generateWaterChunk(tfw::test::logging::loggers::ITestLogger &logger) {
5455
const std::string name = "LCEWaterChunk";
5556

5657
std::unique_ptr<level::FiniteLevel> lvl = std::make_unique<level::FiniteLevel>(level::types::Bounds2i{0, 0, 16, 16});
@@ -115,7 +116,7 @@ namespace lodestone::tests::test {
115116
return tfw::test::result::TestResult(true, wld->toString());
116117
}
117118

118-
tfw::test::result::TestResult MainTests::readAnvilWorld(tfw::test::util::TestOutputLogger &logger) {
119+
tfw::test::result::TestResult MainTests::readAnvilWorld(tfw::test::logging::loggers::ITestLogger &logger) {
119120
const std::string name("AnvilWorld");
120121
const std::filesystem::path dir(util::INPUT_FOLDER / name);
121122
logger << "Reading from " << dir << std::endl;
@@ -145,7 +146,7 @@ namespace lodestone::tests::test {
145146
return tfw::test::result::TestResult(true, w->toString());
146147
}
147148

148-
tfw::test::result::TestResult MainTests::writeAnvilWorld(tfw::test::util::TestOutputLogger &logger) {
149+
tfw::test::result::TestResult MainTests::writeAnvilWorld(tfw::test::logging::loggers::ITestLogger &logger) {
149150
const std::string name("WriteAnvilWorld");
150151
const std::filesystem::path inputDir(util::INPUT_FOLDER / name);
151152
const std::filesystem::path outputDir(util::OUTPUT_FOLDER / name);
@@ -179,7 +180,7 @@ namespace lodestone::tests::test {
179180
return tfw::test::result::TestResult(true, w->toString());
180181
}
181182

182-
// void MainTests::readMcrChunk(tfw::test::util::TestOutputLogger &logger) {
183+
// void MainTests::readMcrChunk(tfw::test::logging::loggers::ITestLogger &logger) {
183184
// OPEN_FILE_STREAM("mcregion_chunk.dat", c);
184185
//
185186
// minecraft::java::mcregion::chunk::McRegionChunkIO *io =
@@ -207,7 +208,7 @@ namespace lodestone::tests::test {
207208
// // lodestone::minecraft::minecraft::java::c0_0_12a));
208209
// }
209210
//
210-
// void MainTests::readMcrFile(tfw::test::util::TestOutputLogger &logger) {
211+
// void MainTests::readMcrFile(tfw::test::logging::loggers::ITestLogger &logger) {
211212
// std::string name("r.0.0.omnibeta");
212213
// OPEN_FILE_STREAM(std::format("{}.mcr", name), c);
213214
//
@@ -235,7 +236,7 @@ namespace lodestone::tests::test {
235236
// // out.close();
236237
// }
237238
//
238-
// void MainTests::readMcrWorld(tfw::test::util::TestOutputLogger &logger) {
239+
// void MainTests::readMcrWorld(tfw::test::logging::loggers::ITestLogger &logger) {
239240
// std::string name("McRegionWorld");
240241
// std::filesystem::path dir(util::INPUT_FOLDER / name);
241242
//
@@ -277,7 +278,7 @@ namespace lodestone::tests::test {
277278
// minecraft::java::b1_3, {});
278279
// }
279280
//
280-
// void MainTests::readMinev2World(tfw::test::util::TestOutputLogger &logger) {
281+
// void MainTests::readMinev2World(tfw::test::logging::loggers::ITestLogger &logger) {
281282
// std::string name("ProjectLodestoneTestWorld");
282283
// OPEN_FILE_STREAM(std::format("{}.mine", name), c);
283284
//
@@ -300,7 +301,7 @@ namespace lodestone::tests::test {
300301
// level::world::World::Dimension::OVERWORLD});
301302
// }
302303
//
303-
// void MainTests::readAlphaWorld(tfw::test::util::TestOutputLogger &logger) {
304+
// void MainTests::readAlphaWorld(tfw::test::logging::loggers::ITestLogger &logger) {
304305
// std::string name("alphaworld");
305306
// std::filesystem::path dir(util::INPUT_FOLDER / name);
306307
//
@@ -337,7 +338,7 @@ namespace lodestone::tests::test {
337338
// }
338339
// }
339340
//
340-
// void MainTests::writeAlphaWorld(tfw::test::util::TestOutputLogger &logger) {
341+
// void MainTests::writeAlphaWorld(tfw::test::logging::loggers::ITestLogger &logger) {
341342
// std::string name("13a_03-level_greffen");
342343
// OPEN_FILE_STREAM(std::format("{}.mine", name), c);
343344
//

0 commit comments

Comments
 (0)