Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Jun 8, 2024
1 parent e919936 commit a05d8ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once
#include <juce_core/zip/zlib/zconf.h>

#if 1 // JUCE_MODULE_AVAILABLE_chowdsp_reflection
#if JUCE_MODULE_AVAILABLE_chowdsp_reflection
#include <chowdsp_reflection/chowdsp_reflection.h>

namespace chowdsp
{
/** A map-like container designed to be used with enum keys. */
template <typename Key, typename T>
struct EnumMap
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ TEST_CASE ("Enum Map Test", "[common][data-structures]")
chowdsp::EnumMap<Food, int> map {};
map.insert_or_assign (Food::Apple, 22);
map.emplace (Food::Green_Beans, 23);
map.emplace (Food::Egg);

REQUIRE (! map.empty());
REQUIRE (map.size() == 2);
REQUIRE (map.size() == 3);
REQUIRE (*map.at (Food::Apple) == 22);
REQUIRE (map[Food::Green_Beans] == 23);
REQUIRE (map[Food::Egg] == 0);
REQUIRE (*std::as_const (map).at (Food::Apple) == 22);
REQUIRE (std::as_const (map)[Food::Green_Beans] == 23);
REQUIRE (map.at (Food::Banana) == std::nullopt);
Expand All @@ -59,6 +61,9 @@ TEST_CASE ("Enum Map Test", "[common][data-structures]")

REQUIRE (map.contains (Food::Apple));
REQUIRE (! map.contains (Food::Green_Beans));

map.clear();
REQUIRE (map.empty());
}

SECTION ("Iteration")
Expand Down

0 comments on commit a05d8ba

Please sign in to comment.