Skip to content

Commit

Permalink
Add set window extent test
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed Nov 30, 2023
1 parent c67a5ca commit 30a26cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/static_map/capacity_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ TEST_CASE("Static map capacity", "")

SECTION("Static window extent can be evaluated at build time.")
{
std::size_t constexpr gold_capacity = 211;
std::size_t constexpr gold_extent = 211;

using extent_type = cuco::experimental::extent<std::size_t, num_keys>;
cuco::experimental::static_map<Key,
Expand All @@ -87,12 +87,10 @@ TEST_CASE("Static map capacity", "")
AllocatorT,
StorageT>
map{extent_type{}, cuco::empty_key<Key>{-1}, cuco::empty_value<T>{-1}};
auto const capacity = map.capacity();
REQUIRE(capacity == gold_capacity);

auto ref = map.ref(cuco::experimental::insert);
auto const num_windows = ref.window_extent();
STATIC_REQUIRE(static_cast<std::size_t>(num_windows) == gold_capacity);
STATIC_REQUIRE(static_cast<std::size_t>(num_windows) == gold_extent);
}

SECTION("Dynamic extent is evaluated at run time.")
Expand Down
14 changes: 14 additions & 0 deletions tests/static_set/capacity_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ TEST_CASE("Static set capacity", "")

constexpr std::size_t num_keys{400};

SECTION("Static window extent can be evaluated at build time.")
{
std::size_t constexpr gold_extent = 211;

using extent_type = cuco::experimental::extent<std::size_t, num_keys>;
cuco::experimental::
static_set<Key, extent_type, cuda::thread_scope_device, Equal, ProbeT, AllocatorT, StorageT>
set{extent_type{}, cuco::empty_key<Key>{-1}};

auto ref = set.ref(cuco::experimental::insert);
auto const num_windows = ref.window_extent();
STATIC_REQUIRE(static_cast<std::size_t>(num_windows) == gold_extent);
}

SECTION("Dynamic extent is evaluated at run time.")
{
auto constexpr gold_capacity = 422; // 211 x 2
Expand Down

0 comments on commit 30a26cd

Please sign in to comment.