Fixed Tests

This commit is contained in:
Rebekah 2025-06-12 11:54:40 -04:00
parent 22dbe42ab4
commit 0d51f729eb
Signed by: oneechanhax
GPG Key ID: 0074BF373B812798
12 changed files with 8 additions and 816 deletions

View File

@ -4,7 +4,7 @@ endif()
add_compile_definitions(TEST_GLOBALS)
add_subdirectory(BlockTypeRegistry)
#add_subdirectory(BlockTypeRegistry)
add_subdirectory(BoundingBox)
add_subdirectory(ByteBuffer)
add_subdirectory(ChunkData)
@ -12,7 +12,6 @@ add_subdirectory(CompositeChat)
add_subdirectory(FastRandom)
add_subdirectory(Generating)
add_subdirectory(HTTP)
add_subdirectory(LuaThreadStress)
add_subdirectory(Network)
add_subdirectory(OSSupport)
add_subdirectory(SchematicFileSerializer)

View File

@ -19,8 +19,6 @@ set (SHARED_SRCS
${PROJECT_SOURCE_DIR}/src/StringUtils.cpp
${PROJECT_SOURCE_DIR}/src/VoronoiMap.cpp
${PROJECT_SOURCE_DIR}/src/Bindings/LuaState.cpp # Needed for PrefabPiecePool loading
${PROJECT_SOURCE_DIR}/src/Noise/Noise.cpp
${PROJECT_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp # Needed for LuaState
@ -50,22 +48,11 @@ set (GENERATING_SRCS
${PROJECT_SOURCE_DIR}/src/Generating/HeiGen.cpp
${PROJECT_SOURCE_DIR}/src/Generating/MineShafts.cpp
${PROJECT_SOURCE_DIR}/src/Generating/Noise3DGenerator.cpp
${PROJECT_SOURCE_DIR}/src/Generating/PieceGeneratorBFSTree.cpp
${PROJECT_SOURCE_DIR}/src/Generating/PieceModifier.cpp
${PROJECT_SOURCE_DIR}/src/Generating/PiecePool.cpp
${PROJECT_SOURCE_DIR}/src/Generating/PieceStructuresGen.cpp
${PROJECT_SOURCE_DIR}/src/Generating/Prefab.cpp
${PROJECT_SOURCE_DIR}/src/Generating/PrefabPiecePool.cpp
${PROJECT_SOURCE_DIR}/src/Generating/PrefabStructure.cpp
${PROJECT_SOURCE_DIR}/src/Generating/Ravines.cpp
${PROJECT_SOURCE_DIR}/src/Generating/RoughRavines.cpp
${PROJECT_SOURCE_DIR}/src/Generating/SinglePieceStructuresGen.cpp
${PROJECT_SOURCE_DIR}/src/Generating/StructGen.cpp
${PROJECT_SOURCE_DIR}/src/Generating/Trees.cpp
${PROJECT_SOURCE_DIR}/src/Generating/TwoHeights.cpp
${PROJECT_SOURCE_DIR}/src/Generating/VerticalLimit.cpp
${PROJECT_SOURCE_DIR}/src/Generating/VerticalStrategy.cpp
${PROJECT_SOURCE_DIR}/src/Generating/VillageGen.cpp
)
set (SHARED_HDRS
@ -86,8 +73,6 @@ set (SHARED_HDRS
${PROJECT_SOURCE_DIR}/src/StringUtils.h
${PROJECT_SOURCE_DIR}/src/VoronoiMap.h
${PROJECT_SOURCE_DIR}/src/Bindings/LuaState.h
${PROJECT_SOURCE_DIR}/src/Noise/Noise.h
${PROJECT_SOURCE_DIR}/src/OSSupport/CriticalSection.h
@ -119,31 +104,17 @@ set (GENERATING_HDRS
${PROJECT_SOURCE_DIR}/src/Generating/IntGen.h
${PROJECT_SOURCE_DIR}/src/Generating/MineShafts.h
${PROJECT_SOURCE_DIR}/src/Generating/Noise3DGenerator.h
${PROJECT_SOURCE_DIR}/src/Generating/PieceGeneratorBFSTree.h
${PROJECT_SOURCE_DIR}/src/Generating/PieceModifier.h
${PROJECT_SOURCE_DIR}/src/Generating/PiecePool.h
${PROJECT_SOURCE_DIR}/src/Generating/PieceStructuresGen.h
${PROJECT_SOURCE_DIR}/src/Generating/Prefab.h
${PROJECT_SOURCE_DIR}/src/Generating/PrefabPiecePool.h
${PROJECT_SOURCE_DIR}/src/Generating/PrefabStructure.h
${PROJECT_SOURCE_DIR}/src/Generating/ProtIntGen.h
${PROJECT_SOURCE_DIR}/src/Generating/Ravines.h
${PROJECT_SOURCE_DIR}/src/Generating/RoughRavines.h
${PROJECT_SOURCE_DIR}/src/Generating/ShapeGen.cpp
${PROJECT_SOURCE_DIR}/src/Generating/SinglePieceStructuresGen.h
${PROJECT_SOURCE_DIR}/src/Generating/StructGen.h
${PROJECT_SOURCE_DIR}/src/Generating/Trees.h
${PROJECT_SOURCE_DIR}/src/Generating/TwoHeights.h
${PROJECT_SOURCE_DIR}/src/Generating/VerticalLimit.h
${PROJECT_SOURCE_DIR}/src/Generating/VerticalStrategy.h
${PROJECT_SOURCE_DIR}/src/Generating/VillageGen.h
)
set (STUBS
Stubs.cpp
LuaState_Typedefs.inc
LuaState_Declaration.inc
Bindings.h
)
@ -161,7 +132,7 @@ add_library(GeneratorTestingSupport STATIC
${GENERATING_HDRS}
${STUBS}
)
target_link_libraries(GeneratorTestingSupport fmt::fmt jsoncpp_static libdeflate lsqlite luaexpat tolualib)
target_link_libraries(GeneratorTestingSupport fmt::fmt jsoncpp_static libdeflate)
source_group("Stubs" FILES ${STUBS})
source_group("Generating" FILES ${GENERATING_HDRS} ${GENERATING_SRCS})
@ -186,60 +157,9 @@ add_test(
# LoadablePieces test:
source_group("Data files" FILES Test.cubeset Test1.schematic)
add_executable(LoadablePieces
LoadablePieces.cpp
Test.cubeset
Test1.schematic
)
target_link_libraries(LoadablePieces GeneratorTestingSupport)
add_test(
NAME LoadablePieces-test
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND LoadablePieces
)
# PieceRotation test:
add_executable(PieceRotation
PieceRotationTest.cpp
)
target_link_libraries(PieceRotation GeneratorTestingSupport)
add_test(
NAME PieceRotation-test
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND PieceRotation
)
# PieceGeneratorBFSTree test:
add_executable(PieceGeneratorBFSTree
PieceGeneratorBFSTreeTest.cpp
)
target_link_libraries(PieceGeneratorBFSTree GeneratorTestingSupport)
add_test(
NAME PieceGeneratorBFSTree-test
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Server/Prefabs/PieceStructures
COMMAND PieceGeneratorBFSTree
)
# Put the projects into solution folders (MSVC):
set_target_properties(
BasicGeneratorTest
GeneratorTestingSupport
LoadablePieces
PieceGeneratorBFSTree
PieceRotation
PROPERTIES FOLDER Tests/Generating
)

View File

@ -7,7 +7,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -23,11 +23,6 @@
#include "Globals.h"
#include "BlockInfo.h"
#include "UUID.h"
#include "Bindings.h"
#include "Bindings/DeprecatedBindings.h"
#include "Bindings/LuaJson.h"
#include "Bindings/LuaState.h"
#include "Bindings/ManualBindings.h"
#include "BlockEntities/BlockEntity.h"
#include "Blocks/BlockHandler.h"
#include "Generating/ChunkDesc.h"
@ -45,72 +40,6 @@
// fwd:
struct lua_State;
// Prototypes, needed by clang:
extern "C" int luaopen_lsqlite3(lua_State * a_LuaState);
extern "C" int luaopen_lxp(lua_State * a_LuaState);
void cManualBindings::Bind(lua_State * a_LuaState)
{
}
void DeprecatedBindings::Bind(lua_State * a_LuaState)
{
}
void cLuaJson::Bind(cLuaState & a_LuaState)
{
}
int tolua_AllToLua_open(lua_State * a_LuaState)
{
return 0;
}
extern "C" int luaopen_lsqlite3(lua_State * a_LuaState)
{
return 0;
}
extern "C" int luaopen_lxp(lua_State * a_LuaState)
{
return 0;
}
cBoundingBox::cBoundingBox(double, double, double, double, double, double)
{
}
@ -128,7 +57,7 @@ cBoundingBox cBlockHandler::GetPlacementCollisionBox(BLOCKTYPE a_XM, BLOCKTYPE a
void cBlockHandler::OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, const Vector3i a_RelPos) const
void cBlockHandler::OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cChunk & a_Chunk, const Vector3i a_RelPos) const
{
}
@ -188,7 +117,7 @@ bool cBlockHandler::DoesIgnoreBuildCollision(const cWorld & a_World, const cItem
void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, Vector3i a_RelPos, cChunk & a_Chunk) const
void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, Vector3i a_RelPos, cChunk & a_Chunk) const
{
}
@ -276,15 +205,6 @@ OwnedBlockEntity cBlockEntity::Clone(Vector3i a_Pos)
bool cLuaState::GetStackValue(int, cUUID *&)
{
return false;
}
bool cUUID::FromString(const AString&)
{
return false;

View File

@ -1,31 +0,0 @@
/*
* Copyright 2011-2022 Cuberite Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Bindings.h
// Dummy include file needed for LuaState to compile successfully
struct lua_State;
int tolua_AllToLua_open(lua_State * a_LuaState);

View File

@ -1,93 +0,0 @@
find_package(Threads REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/src/)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/lib/)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set (SHARED_SRCS
${PROJECT_SOURCE_DIR}/src/BiomeDef.cpp
${PROJECT_SOURCE_DIR}/src/BlockArea.cpp
${PROJECT_SOURCE_DIR}/src/Cuboid.cpp
${PROJECT_SOURCE_DIR}/src/ChunkData.cpp
${PROJECT_SOURCE_DIR}/src/StringCompression.cpp
${PROJECT_SOURCE_DIR}/src/StringUtils.cpp
${PROJECT_SOURCE_DIR}/src/Bindings/LuaState.cpp
${PROJECT_SOURCE_DIR}/src/Generating/ChunkDesc.cpp
${PROJECT_SOURCE_DIR}/src/Generating/PieceModifier.cpp
${PROJECT_SOURCE_DIR}/src/Generating/PiecePool.cpp
${PROJECT_SOURCE_DIR}/src/Generating/Prefab.cpp
${PROJECT_SOURCE_DIR}/src/Generating/PrefabPiecePool.cpp
${PROJECT_SOURCE_DIR}/src/Generating/VerticalLimit.cpp
${PROJECT_SOURCE_DIR}/src/Generating/VerticalStrategy.cpp
${PROJECT_SOURCE_DIR}/src/Noise/Noise.cpp
${PROJECT_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
${PROJECT_SOURCE_DIR}/src/OSSupport/Event.cpp
${PROJECT_SOURCE_DIR}/src/OSSupport/File.cpp
${PROJECT_SOURCE_DIR}/src/OSSupport/GZipFile.cpp
${PROJECT_SOURCE_DIR}/src/OSSupport/StackTrace.cpp
${PROJECT_SOURCE_DIR}/src/OSSupport/WinStackWalker.cpp
${PROJECT_SOURCE_DIR}/src/WorldStorage/FastNBT.cpp
${PROJECT_SOURCE_DIR}/src/WorldStorage/SchematicFileSerializer.cpp
)
set (SHARED_HDRS
${PROJECT_SOURCE_DIR}/src/BiomeDef.h
${PROJECT_SOURCE_DIR}/src/BlockArea.h
${PROJECT_SOURCE_DIR}/src/Cuboid.h
${PROJECT_SOURCE_DIR}/src/ChunkData.h
${PROJECT_SOURCE_DIR}/src/Globals.h
${PROJECT_SOURCE_DIR}/src/StringCompression.h
${PROJECT_SOURCE_DIR}/src/StringUtils.h
${PROJECT_SOURCE_DIR}/src/Bindings/LuaState.h
${PROJECT_SOURCE_DIR}/src/Generating/ChunkDesc.h
${PROJECT_SOURCE_DIR}/src/Generating/PieceModifier.h
${PROJECT_SOURCE_DIR}/src/Generating/PiecePool.h
${PROJECT_SOURCE_DIR}/src/Generating/Prefab.h
${PROJECT_SOURCE_DIR}/src/Generating/PrefabPiecePool.h
${PROJECT_SOURCE_DIR}/src/Generating/VerticalLimit.h
${PROJECT_SOURCE_DIR}/src/Generating/VerticalStrategy.h
${PROJECT_SOURCE_DIR}/src/Noise/Noise.h
${PROJECT_SOURCE_DIR}/src/OSSupport/CriticalSection.h
${PROJECT_SOURCE_DIR}/src/OSSupport/Event.h
${PROJECT_SOURCE_DIR}/src/OSSupport/File.h
${PROJECT_SOURCE_DIR}/src/OSSupport/GZipFile.h
${PROJECT_SOURCE_DIR}/src/OSSupport/StackTrace.h
${PROJECT_SOURCE_DIR}/src/OSSupport/WinStackWalker.h
${PROJECT_SOURCE_DIR}/src/WorldStorage/FastNBT.h
${PROJECT_SOURCE_DIR}/src/WorldStorage/SchematicFileSerializer.h
)
set (SRCS
LuaThreadStress.cpp
Stubs.cpp
LuaState_Typedefs.inc
LuaState_Declaration.inc
Bindings.h
)
source_group("Shared" FILES ${SHARED_SRCS} ${SHARED_HDRS})
source_group("Sources" FILES ${SRCS})
source_group("Lua files" FILES Test.lua)
add_executable(LuaThreadStress ${SRCS} ${SHARED_SRCS} ${SHARED_HDRS} Test.lua)
target_link_libraries(LuaThreadStress fmt::fmt libdeflate lsqlite luaexpat Threads::Threads tolualib)
add_test(NAME LuaThreadStress-test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND LuaThreadStress)
# Put the projects into solution folders (MSVC):
set_target_properties(
LuaThreadStress
PROPERTIES FOLDER Tests
)

View File

@ -1,9 +0,0 @@
// LuaState_Declaration.inc
// Dummy include file needed for LuaState to compile successfully
bool GetStackValue(int, cUUID *&);

View File

@ -1,20 +0,0 @@
// LuaState_Typedefs.inc
// Dummy include file needed for LuaState to compile successfully
// Forward-declare classes that are used in the API but never called:
struct HTTPRequest;
struct HTTPTemplateRequest;
class cPluginLua;
class cBoundingBox;
template <typename T> class cItemCallback;
class cEntity;
class cUUID;

View File

@ -1,170 +0,0 @@
/*
* Copyright 2011-2022 Cuberite Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// LuaThreadStress.cpp
// Implements a stress-test of cLuaState under several threads
#include "Globals.h"
#include "Bindings/LuaState.h"
#include <thread>
#include <random>
/** How long the threading test should run. */
static const int NUM_SECONDS_TO_TEST = 10;
/** Retrieves a callback from the Lua state that can be later called.
Calls the Lua function getCallback with a_Seed param to retrieve the callback. */
static cLuaState::cCallbackPtr getCallback(cLuaState & a_LuaState, unsigned a_Seed)
{
cLuaState::cLock lock(a_LuaState);
cLuaState::cCallbackPtr res;
a_LuaState.Call("getCallback", a_Seed, cLuaState::Return, res);
return res;
}
/** Runs a single thread that stress-tests the cLuaState object.
a_LuaState is the Lua state on which to operate.
a_Seed is the seed for the random number generator for this thread.
a_ShouldTerminate is a bool flag that another thread sets to ask this thread to terminate.
a_FailResult is a shared result state that is written by any thread upon failure (so if it contains nonzero, at least one thread has failed). */
static void runStress(cLuaState * a_LuaState, unsigned a_Seed, std::atomic<bool> * a_ShouldTerminate, std::atomic<int> * a_FailResult)
{
std::minstd_rand rnd;
rnd.seed(a_Seed);
auto callbackSeed = static_cast<unsigned>(rnd());
auto callback = getCallback(*a_LuaState, callbackSeed);
while (!a_ShouldTerminate->load())
{
// Pick a random operation on the Lua state and peform it:
switch (rnd() % 4)
{
case 0:
{
// Get a new callback:
callbackSeed = callbackSeed + 1;
callback = getCallback(*a_LuaState, callbackSeed);
break;
}
default:
{
// Call the callback, if still available:
auto param = static_cast<unsigned>(rnd());
unsigned returnValue;
if (callback->Call(param, cLuaState::Return, returnValue))
{
if (returnValue != param + callbackSeed)
{
LOGWARNING("Bad value returned from the callback");
*a_FailResult = 2;
a_ShouldTerminate->store(true);
return;
}
}
break;
}
} // switch (random)
// Once in every ~10k operations, reload the lua state completely:
if ((rnd() % 10000) == 0)
{
cLuaState::cLock lock(*a_LuaState);
a_LuaState->Close();
a_LuaState->Create();
if (!a_LuaState->LoadFile("Test.lua"))
{
*a_FailResult = 3;
a_ShouldTerminate->store(true);
return;
}
}
} // while (!a_ShouldTerminate)
}
static int DoTest(void)
{
cLuaState L("LuaThreadStress test");
L.Create();
if (!L.LoadFile("Test.lua"))
{
return 1;
}
// Start the concurrect threads:
std::atomic<bool> shouldTerminate(false);
std::atomic<int> failResult(0);
std::thread threads[] =
{
std::thread(runStress, &L, 0, &shouldTerminate, &failResult),
std::thread(runStress, &L, 1, &shouldTerminate, &failResult),
std::thread(runStress, &L, 2, &shouldTerminate, &failResult),
std::thread(runStress, &L, 3, &shouldTerminate, &failResult),
};
// Let the threads run wild:
for (int i = 1; i <= NUM_SECONDS_TO_TEST; ++i)
{
std::this_thread::sleep_for(std::chrono::seconds(1));
LOG("Testing (%d out of %d seconds)...", i, NUM_SECONDS_TO_TEST);
}
// Terminate everything:
LOG("Terminating the threads");
shouldTerminate = true;
for (auto & t: threads)
{
t.join();
}
LOG("Threads terminated.");
return failResult.load();
}
int main()
{
LOG("LuaThreadStress starting.");
int res = DoTest();
LOG("LuaThreadStress test done: %s", (res == 0) ? "success" : "failure");
if (res != 0)
{
return res;
}
LOG("LuaThreadStress finished.");
return 0;
}

View File

@ -1,300 +0,0 @@
/*
* Copyright 2011-2022 Cuberite Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Stubs.cpp
// Implements stubs of various Cuberite methods that are needed for linking but not for runtime
// This is required so that we don't bring in the entire Cuberite via dependencies
#include "Globals.h"
#include "BlockInfo.h"
#include "Bindings.h"
#include "DeadlockDetect.h"
#include "UUID.h"
#include "Bindings/DeprecatedBindings.h"
#include "Bindings/LuaJson.h"
#include "Bindings/ManualBindings.h"
#include "BlockEntities/BlockEntity.h"
#include "Blocks/BlockHandler.h"
#include "Generating/ChunkDesc.h"
// fwd:
struct lua_State;
// Prototypes, needed by clang:
extern "C" int luaopen_lsqlite3(lua_State * a_LuaState);
extern "C" int luaopen_lxp(lua_State * a_LuaState);
void cManualBindings::Bind(lua_State * a_LuaState)
{
}
void DeprecatedBindings::Bind(lua_State * a_LuaState)
{
}
void cLuaJson::Bind(cLuaState & a_LuaState)
{
}
int tolua_AllToLua_open(lua_State * a_LuaState)
{
return 0;
}
extern "C" int luaopen_lsqlite3(lua_State * a_LuaState)
{
return 0;
}
extern "C" int luaopen_lxp(lua_State * a_LuaState)
{
return 0;
}
bool cBlockInfo::IsSolid(BLOCKTYPE)
{
return false;
}
cBoundingBox::cBoundingBox(double, double, double, double, double, double)
{
}
cBoundingBox cBlockHandler::GetPlacementCollisionBox(BLOCKTYPE a_XM, BLOCKTYPE a_XP, BLOCKTYPE a_YM, BLOCKTYPE a_YP, BLOCKTYPE a_ZM, BLOCKTYPE a_ZP) const
{
return cBoundingBox(0, 0, 0, 0, 0, 0);
}
void cBlockHandler::OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, const Vector3i a_RelPos) const
{
}
void cBlockHandler::OnNeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor) const
{
}
void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor)
{
}
cItems cBlockHandler::ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const
{
return cItems();
}
bool cBlockHandler::CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const
{
return true;
}
bool cBlockHandler::IsUseable() const
{
return false;
}
bool cBlockHandler::DoesIgnoreBuildCollision(const cWorld & a_World, const cItem & a_HeldItem, Vector3i a_Position, NIBBLETYPE a_Meta, eBlockFace a_ClickedBlockFace, bool a_ClickedDirectly) const
{
return m_BlockType == E_BLOCK_AIR;
}
void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, Vector3i a_RelPos, cChunk & a_Chunk) const
{
}
ColourID cBlockHandler::GetMapBaseColourID(NIBBLETYPE a_Meta) const
{
return 0;
}
bool cBlockHandler::IsInsideBlock(Vector3d a_Position, const NIBBLETYPE a_BlockMeta) const
{
return true;
}
const cBlockHandler & cBlockHandler::For(BLOCKTYPE a_BlockType)
{
// Dummy handler.
static cBlockHandler Handler(E_BLOCK_AIR);
return Handler;
}
OwnedBlockEntity cBlockEntity::CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World)
{
return nullptr;
}
void cDeadlockDetect::TrackCriticalSection(cCriticalSection & a_CS, const AString & a_Name)
{
}
void cDeadlockDetect::UntrackCriticalSection(cCriticalSection & a_CS)
{
}
void cBlockEntity::SetPos(Vector3i a_NewPos)
{
}
bool cBlockEntity::IsBlockEntityBlockType(BLOCKTYPE a_BlockType)
{
return false;
}
OwnedBlockEntity cBlockEntity::Clone(Vector3i a_Pos)
{
return nullptr;
}
bool cLuaState::GetStackValue(int, cUUID *&)
{
return false;
}
bool cUUID::FromString(const AString &)
{
return true;
}
int BlockStringToType(const AString &)
{
return 0;
}

View File

@ -1,17 +0,0 @@
-- Test.lua
-- Implements the test support functions
-- This file is loaded into the cLuaState used for stress-testing
--- Returns a function that the C++ code can call
-- The callback takes a single number as param and returns the sum of the param and the seed, given to this factory function (for verification)
function getCallback(a_Seed)
return function (a_Param)
-- print("Callback " .. a_Seed .. " called with param " .. a_Param)
return a_Param + a_Seed
end
end

View File

@ -32,14 +32,7 @@ set (SHARED_HDRS
${PROJECT_SOURCE_DIR}/src/StringCompression.h
${PROJECT_SOURCE_DIR}/src/StringUtils.h
${PROJECT_SOURCE_DIR}/src/Bindings/LuaState.h
${PROJECT_SOURCE_DIR}/src/Generating/ChunkDesc.h
${PROJECT_SOURCE_DIR}/src/Generating/PiecePool.h
${PROJECT_SOURCE_DIR}/src/Generating/Prefab.h
${PROJECT_SOURCE_DIR}/src/Generating/PrefabPiecePool.h
${PROJECT_SOURCE_DIR}/src/Generating/VerticalLimit.h
${PROJECT_SOURCE_DIR}/src/Generating/VerticalStrategy.h
${PROJECT_SOURCE_DIR}/src/Noise/Noise.h

View File

@ -7,7 +7,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -46,7 +46,7 @@ cBoundingBox cBlockHandler::GetPlacementCollisionBox(BLOCKTYPE a_XM, BLOCKTYPE a
void cBlockHandler::OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, const Vector3i a_RelPos) const
void cBlockHandler::OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cChunk & a_Chunk, const Vector3i a_RelPos) const
{
}
@ -106,7 +106,7 @@ bool cBlockHandler::DoesIgnoreBuildCollision(const cWorld & a_World, const cItem
void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, Vector3i a_RelPos, cChunk & a_Chunk) const
void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, Vector3i a_RelPos, cChunk & a_Chunk) const
{
}