Skip to content
Snippets Groups Projects
Commit fcce989b authored by Spiros Tsalikis's avatar Spiros Tsalikis
Browse files

Add Test for mapComponent in TestImplicitArrayTraits

parent c5a96ed5
No related merge requests found
......@@ -39,6 +39,13 @@ struct HasMapAndMapTuple
void mapTuple(int, float* tuple) const { tuple[0] = tuple[1] = tuple[2] = 0.0; }
};
struct HasMapAndMapComponent
{
float map(int) const { return 0.0; }
float mapComponent(int, int) const { return 0.0; }
};
struct IsClosure
{
float operator()(int) const { return 0.0; }
......@@ -76,6 +83,12 @@ int TestImplicitArrayTraits(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
result = EXIT_FAILURE;
}
if (vtk::detail::can_map_component_trait<::HasNothing>::value)
{
std::cout << "Failed can_map_component_trait check on HasNothing" << std::endl;
result = EXIT_FAILURE;
}
static_assert(!vtk::detail::is_closure_trait<::HasNothing>::value,
"HasNothing being attributed a is_closure_trait");
if (vtk::detail::is_closure_trait<::HasNothing>::value)
......@@ -135,6 +148,12 @@ int TestImplicitArrayTraits(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
result = EXIT_FAILURE;
}
if (vtk::detail::can_map_component_trait<::HasMap>::value)
{
std::cout << "Failed can_map_component_trait check on HasMap" << std::endl;
result = EXIT_FAILURE;
}
if (!vtk::detail::implicit_array_traits<::HasMap>::can_read)
{
std::cout << "Failed can_read check on HasMap" << std::endl;
......@@ -161,12 +180,12 @@ int TestImplicitArrayTraits(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
//--------------------------------------------------------------------------------
static_assert(vtk::detail::has_map_trait<::HasMapAndMapTuple>::value,
"HasMap is not being attributed a has_map_trait");
"HasMapAndMapTuple is not being attributed a has_map_trait");
static_assert(vtk::detail::has_map_tuple_trait<::HasMapAndMapTuple>::value,
"HasMapAndMapTuple is not being attributed a has_map_tuple_trait");
if (!vtk::detail::has_map_tuple_trait<::HasMapAndMapTuple>::value)
{
std::cout << "Failed has_map_trait check on HasMap" << std::endl;
std::cout << "Failed has_map_trait check on HasMapAndMapTuple" << std::endl;
result = EXIT_FAILURE;
}
......@@ -182,6 +201,12 @@ int TestImplicitArrayTraits(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
result = EXIT_FAILURE;
}
if (vtk::detail::can_map_component_trait<::HasMapAndMapTuple>::value)
{
std::cout << "Failed can_map_component_trait check on HasMapAndMapTuple" << std::endl;
result = EXIT_FAILURE;
}
if (!vtk::detail::implicit_array_traits<::HasMapAndMapTuple>::can_read)
{
std::cout << "Failed can_read check on HasMapAndMapTuple" << std::endl;
......@@ -207,6 +232,62 @@ int TestImplicitArrayTraits(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
result = EXIT_FAILURE;
}
//--------------------------------------------------------------------------------
static_assert(vtk::detail::has_map_trait<::HasMapAndMapComponent>::value,
"HasMapAndMapComponent is not being attributed a has_map_trait");
static_assert(vtk::detail::has_map_component_trait<::HasMapAndMapComponent>::value,
"HasMapAndMapComponent is not being attributed a has_map_component_trait");
if (vtk::detail::has_map_tuple_trait<::HasMapAndMapComponent>::value)
{
std::cout << "Failed has_map_trait check on HasMapAndMapComponent" << std::endl;
result = EXIT_FAILURE;
}
if (!vtk::detail::can_map_trait<::HasMapAndMapComponent>::value)
{
std::cout << "Failed can_map_trait check on HasMapAndMapComponent" << std::endl;
result = EXIT_FAILURE;
}
if (vtk::detail::can_map_tuple_trait<::HasMapAndMapComponent>::value)
{
std::cout << "Failed can_map_tuple_trait check on HasMapAndMapComponent" << std::endl;
result = EXIT_FAILURE;
}
if (!vtk::detail::can_map_component_trait<::HasMapAndMapComponent>::value)
{
std::cout << "Failed can_map_component_trait check on HasMapAndMapComponent" << std::endl;
result = EXIT_FAILURE;
}
if (!vtk::detail::implicit_array_traits<::HasMapAndMapComponent>::can_read)
{
std::cout << "Failed can_read check on HasMapAndMapComponent" << std::endl;
result = EXIT_FAILURE;
}
if (!std::is_same<vtk::detail::implicit_array_traits<::HasMapAndMapComponent>::rtype,
float>::value)
{
std::cout << "Failed rtype check on HasMapAndMapComponent" << std::endl;
result = EXIT_FAILURE;
}
if (!std::is_same<vtk::detail::implicit_array_traits<::HasMapAndMapComponent>::type,
::HasMapAndMapComponent>::value)
{
std::cout << "Failed type check on HasMapAndMapComponent" << std::endl;
result = EXIT_FAILURE;
}
if (vtk::detail::implicit_array_traits<::HasMapAndMapComponent>::code !=
vtk::detail::iarrays::MAP)
{
std::cout << "Failed code check on HasMapAndMapComponent" << std::endl;
result = EXIT_FAILURE;
}
//--------------------------------------------------------------------------------
static_assert(vtk::detail::is_closure_trait<::IsClosure>::value,
"IsClosure is not being attributed a is_closure_trait");
......@@ -228,6 +309,12 @@ int TestImplicitArrayTraits(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
result = EXIT_FAILURE;
}
if (vtk::detail::can_map_component_trait<::IsClosure>::value)
{
std::cout << "Failed can_map_component_trait check on IsClosure" << std::endl;
result = EXIT_FAILURE;
}
if (!vtk::detail::implicit_array_traits<::IsClosure>::can_read)
{
std::cout << "Failed can_read check on IsClosure" << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment