Skip to content

Commit

Permalink
More CI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Jun 18, 2024
1 parent d40daca commit 60c4de2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct STLArenaAllocator

T* allocate (std::size_t n)
{
return static_cast<T*> (arena.allocate_bytes (n, alignof (T)));
return static_cast<T*> (arena.allocate_bytes (n * sizeof (T), alignof (T)));
}

void deallocate (T*, std::size_t) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ template <typename ElementType, typename DerivedType>
AbstractTree<ElementType, DerivedType>::~AbstractTree()
{
doForAllNodes ([] (Node& node)
{ node.~Node(); });
{ node.leaf.reset(); });
}

template <typename ElementType, typename DerivedType>
Expand Down Expand Up @@ -108,7 +108,7 @@ void AbstractTree<ElementType, DerivedType>::removeNode (Node& node)
node.parent->last_child = node.prev_sibling;
}

node.~Node();
node.leaf.reset();
}

template <typename ElementType, typename DerivedType>
Expand Down Expand Up @@ -150,9 +150,10 @@ template <typename ElementType, typename DerivedType>
void AbstractTree<ElementType, DerivedType>::clear()
{
doForAllNodes ([] (Node& node)
{ node.~Node(); });
{ node.leaf.reset(); });
allocator.reset (64 * sizeof (Node));
count = 0;
root_node = {};
}

template <typename ElementType, typename DerivedType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ struct EnumMap
{
++index;
++iter;
} while (! iter->has_value() && index < std::tuple_size_v<Storage>);
} while (index < std::tuple_size_v<Storage> && ! iter->has_value());

if (index < std::tuple_size_v<Storage>)
key = magic_enum::enum_value<Key> (index);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <CatchUtils.h>
#include <chowdsp_data_structures/chowdsp_data_structures.h>

#if ! JUCE_WINDOWS // @TODO

struct StringTree : chowdsp::AbstractTree<std::string, StringTree>
{
static Node& insert_string (std::string&& element, Node& parent_node, AbstractTree& tree)
Expand Down Expand Up @@ -161,4 +159,3 @@ TEST_CASE ("Abstract Tree Test", "[common][data-structures]")
});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ TEST_CASE ("Enum Map Test", "[common][data-structures]")
iter = 0;
for (auto [key, val] : map)
val = static_cast<int> (iter++);
#if ! JUCE_WINDOWS // @TODO
REQUIRE (map[Food::Apple] == 0);
REQUIRE (map[Food::Green_Beans] == 1);
#endif
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <CatchUtils.h>
#include <chowdsp_data_structures/chowdsp_data_structures.h>

#if ! JUCE_WINDOWS // @TODO

TEST_CASE ("STL Arena Allocator Test", "[common][data-structures]")
{
using Arena = chowdsp::ArenaAllocator<>;
Expand All @@ -27,5 +25,3 @@ TEST_CASE ("STL Arena Allocator Test", "[common][data-structures]")
REQUIRE (vec.size() == 5);
REQUIRE (vec.front() == 0);
}

#endif

0 comments on commit 60c4de2

Please sign in to comment.