mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-03-14 20:27:24 +00:00
70 lines
1.6 KiB
Plaintext
70 lines
1.6 KiB
Plaintext
#include <nvbench/type_axis.cuh>
|
|
|
|
#include <nvbench/types.cuh>
|
|
|
|
#include "test_asserts.cuh"
|
|
|
|
#include <fmt/format.h>
|
|
|
|
void test_empty()
|
|
{
|
|
nvbench::type_axis axis("Basic");
|
|
ASSERT(axis.get_name() == "Basic");
|
|
ASSERT(axis.get_type() == nvbench::axis_type::type);
|
|
ASSERT(axis.get_size() == 0);
|
|
|
|
axis.set_inputs<nvbench::type_list<>>();
|
|
|
|
ASSERT(axis.get_size() == 0);
|
|
}
|
|
|
|
void test_single()
|
|
{
|
|
nvbench::type_axis axis("Single");
|
|
ASSERT(axis.get_name() == "Single");
|
|
|
|
axis.set_inputs<nvbench::type_list<nvbench::int32_t>>();
|
|
|
|
ASSERT(axis.get_size() == 1);
|
|
ASSERT(axis.get_input_string(0) == "I32");
|
|
ASSERT(axis.get_description(0) == "int32_t");
|
|
}
|
|
|
|
void test_several()
|
|
{
|
|
nvbench::type_axis axis("Several");
|
|
ASSERT(axis.get_name() == "Several");
|
|
|
|
axis.set_inputs<
|
|
nvbench::type_list<nvbench::int32_t, nvbench::float64_t, bool>>();
|
|
|
|
ASSERT(axis.get_size() == 3);
|
|
ASSERT(axis.get_input_string(0) == "I32");
|
|
ASSERT(axis.get_description(0) == "int32_t");
|
|
ASSERT(axis.get_input_string(1) == "F64");
|
|
ASSERT(axis.get_description(1) == "double");
|
|
ASSERT(axis.get_input_string(2) == "bool");
|
|
ASSERT(axis.get_description(2) == "");
|
|
}
|
|
|
|
void test_get_index()
|
|
{
|
|
nvbench::type_axis axis("GetIndexTest");
|
|
axis.set_inputs<
|
|
nvbench::
|
|
type_list<nvbench::int8_t, nvbench::uint16_t, nvbench::float32_t, bool>>();
|
|
|
|
ASSERT(axis.get_index("I8") == 0);
|
|
ASSERT(axis.get_index("U16") == 1);
|
|
ASSERT(axis.get_index("F32") == 2);
|
|
ASSERT(axis.get_index("bool") == 3);
|
|
}
|
|
|
|
int main()
|
|
{
|
|
test_empty();
|
|
test_single();
|
|
test_several();
|
|
test_get_index();
|
|
}
|