File: parameter_test.cpp

package info (click to toggle)
xenium 0.0.2%2Bds-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,152 kB
  • sloc: cpp: 12,299; makefile: 20
file content (29 lines) | stat: -rw-r--r-- 988 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <xenium/parameter.hpp>
#include <xenium/ramalhete_queue.hpp>

#include <gtest/gtest.h>

struct my_reclaimer {};
struct my_backoff {};

namespace {
  using pack = xenium::parameter::pack<
    xenium::policy::entries_per_node<42>,
    xenium::policy::reclaimer<my_reclaimer>,
    xenium::policy::backoff<my_backoff>>;

  TEST(Parameter, type_param_extracts_type_from_specified_policy)
  {
    using reclaimer = typename xenium::parameter::type_param<xenium::policy::reclaimer, pack>::type;
    static_assert(std::is_same<reclaimer, my_reclaimer>::value, "");

    using backoff = typename xenium::parameter::type_param<xenium::policy::backoff, pack>::type;
    static_assert(std::is_same<backoff, my_backoff>::value, "");
  }

  TEST(Parameter, type_param_extracts_value_from_specified_policy)
  {
    constexpr auto entries_per_node = xenium::parameter::value_param<unsigned, xenium::policy::entries_per_node, pack, 0>::value;
    static_assert(entries_per_node == 42, "");
  }
}