Skip to content

Commit

Permalink
macos try again
Browse files Browse the repository at this point in the history
  • Loading branch information
jadebenn committed Jan 22, 2024
1 parent 0107076 commit a6cba14
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(Darkflame)
include(CTest)

set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

# Read variables from file
Expand Down
22 changes: 6 additions & 16 deletions tests/dGameTests/dEntitiesTests/ArchetypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ namespace {
};

template <typename T>
struct TestContainerVisitor2 {
struct ContainerVisitor {
std::vector<T>* const operator()(auto&& archetype) {
using ArchetypeType = std::remove_pointer_t<std::remove_reference_t<decltype(*archetype)>>; // Needed to fix a MacOS issue

Expand Down Expand Up @@ -334,27 +334,17 @@ TEST_F(ArchetypeTest, IterateOverArchetypesTest) {
}*/

for (const auto& archetypeVariantPtr : archetypes) {
auto&& destCompCont = std::visit(TestContainerVisitor2<DestroyableComponent>(), archetypeVariantPtr);
if (!destCompCont) continue;
auto&& destCompContainer = std::visit(ContainerVisitor<DestroyableComponent>(), archetypeVariantPtr);
if (!destCompContainer) continue;

for (auto& destComp : *destCompCont) {
for (auto&& destComp : *destCompContainer) {
const auto randNum = rand();
destComp.SetArmor(randNum);
ASSERT_EQ(randNum, destComp.GetArmor());
}
}

/*for (auto& archetypeVariantPtr : archetypes) { // For the archetypes in m_Archetypes
const bool archetypeHasComponent = std::visit([](auto&& archetype), archetypeVariantPtr);
if (!archetypeHasComponent) continue; // Skip archetypes that don't have the relevant component
auto&& destCompCont = std::visit([](auto&& archetype) { return archetype->template Container<DestroyableComponent>(); }, archetypeVariantPtr); // Get destroyable component container
for (auto& destComp : destCompCont) {
const auto randNum = rand();
destComp.SetArmor(randNum);
ASSERT_EQ(randNum, destComp.GetArmor());
}
}*/
// TODO: The outer foor loop can be simplified a little bit by grabbing the
// archetypes known to contain the correct component types ahead of time

// Expanded version
/*for (auto it = archetypes.begin(), end = archetypes.end(); it != end; ++it) {
Expand Down

0 comments on commit a6cba14

Please sign in to comment.