Namespaces | Typedefs | Functions
type_lists.hpp File Reference

Provides centralized type lists for use in Google Test type-parameterized tests. More...

#include <cudf_test/type_list_utilities.hpp>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/strings/string_view.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/export.hpp>
#include <cudf/utilities/traits.hpp>
#include <cudf/utilities/type_dispatcher.hpp>
#include <cudf/wrappers/durations.hpp>
#include <cudf/wrappers/timestamps.hpp>
#include <thrust/host_vector.h>
#include <array>
#include <tuple>
#include <type_traits>

Go to the source code of this file.

Namespaces

 cudf
 cuDF interfaces
 

Typedefs

using cudf::test::IntegralTypesNotBool = cudf::test::Types< int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t >
 Type list for all integral types except type bool.
 
using cudf::test::IntegralTypes = Concat< IntegralTypesNotBool, cudf::test::Types< bool > >
 Type list for all integral types.
 
using cudf::test::FloatingPointTypes = cudf::test::Types< float, double >
 Provides a list of all floating point types supported in libcudf for use in a GTest typed test. More...
 
using cudf::test::NumericTypes = Concat< IntegralTypes, FloatingPointTypes >
 Provides a list of all numeric types supported in libcudf for use in a GTest typed test. More...
 
using cudf::test::TimestampTypes = cudf::test::Types< timestamp_D, timestamp_s, timestamp_ms, timestamp_us, timestamp_ns >
 Provides a list of all timestamp types supported in libcudf for use in a GTest typed test. More...
 
using cudf::test::DurationTypes = cudf::test::Types< duration_D, duration_s, duration_ms, duration_us, duration_ns >
 Provides a list of all duration types supported in libcudf for use in a GTest typed test. More...
 
using cudf::test::ChronoTypes = Concat< TimestampTypes, DurationTypes >
 Provides a list of all chrono types supported in libcudf for use in a GTest typed test. More...
 
using cudf::test::StringTypes = cudf::test::Types< string_view >
 Provides a list of all string types supported in libcudf for use in a GTest typed test. More...
 
using cudf::test::ListTypes = cudf::test::Types< list_view >
 Provides a list of all list types supported in libcudf for use in a GTest typed test. More...
 
using cudf::test::FixedPointTypes = cudf::test::Types< numeric::decimal32, numeric::decimal64, numeric::decimal128 >
 Provides a list of all fixed-point element types for use in GTest typed tests. More...
 
using cudf::test::FixedWidthTypes = Concat< NumericTypes, ChronoTypes, FixedPointTypes >
 Provides a list of all fixed-width element types for use in GTest typed tests. More...
 
using cudf::test::FixedWidthTypesWithoutFixedPoint = Concat< NumericTypes, ChronoTypes >
 Provides a list of all fixed-width element types except for the fixed-point types for use in GTest typed tests. More...
 
using cudf::test::FixedWidthTypesWithoutChrono = Concat< NumericTypes, FixedPointTypes >
 Provides a list of all fixed-width element types except for the chrono types for use in GTest typed tests. More...
 
using cudf::test::ComparableTypes = Concat< NumericTypes, ChronoTypes, StringTypes >
 Provides a list of sortable types for use in GTest typed tests. More...
 
using cudf::test::CompoundTypes = cudf::test::Types< cudf::string_view, cudf::dictionary32, cudf::list_view, cudf::struct_view >
 Provides a list of all compound types for use in GTest typed tests. More...
 
using cudf::test::AllTypes = Concat< NumericTypes, ChronoTypes, FixedPointTypes >
 Provides a list of all types supported in libcudf for use in a GTest typed test. More...
 

Functions

template<typename TYPES >
constexpr auto cudf::test::detail::types_to_ids ()
 Converts a Types list of types into a std::array of the corresponding cudf::type_ids for each type in the list. More...
 
template<typename TypeParam , typename T >
std::enable_if_t< cudf::is_fixed_width< TypeParam >) &&!cudf::is_timestamp_t< TypeParam >::value, thrust::host_vector< TypeParam > > cudf::test::make_type_param_vector (std::initializer_list< T > const &init_list)
 Convert numeric values of type T to numeric vector of type TypeParam. More...
 
template<typename TypeParam , typename T >
std::enable_if_t< cudf::is_timestamp_t< TypeParam >::value, thrust::host_vector< TypeParam > > cudf::test::make_type_param_vector (std::initializer_list< T > const &init_list)
 Convert numeric values of type T to timestamp vector. More...
 
template<typename TypeParam , typename T >
std::enable_if_t< std::is_same_v< TypeParam, std::string >, thrust::host_vector< std::string > > cudf::test::make_type_param_vector (std::initializer_list< T > const &init_list)
 Convert numeric values of type T to vector of std::string. More...
 
template<typename TypeParam , typename T >
std::enable_if_t< cudf::is_fixed_width< TypeParam >) &&!cudf::is_timestamp_t< TypeParam >::value, TypeParam > cudf::test::make_type_param_scalar (T const init_value)
 Convert the numeric value of type T to a fixed width type of type TypeParam. More...
 
template<typename TypeParam , typename T >
std::enable_if_t< cudf::is_timestamp_t< TypeParam >::value, TypeParam > cudf::test::make_type_param_scalar (T const init_value)
 Convert the timestamp value of type T to a fixed width type of type TypeParam. More...
 
template<typename TypeParam , typename T >
std::enable_if_t< std::is_same_v< TypeParam, std::string >, TypeParam > cudf::test::make_type_param_scalar (T const init_value)
 Convert the numeric value of type T to a string type. More...
 

Detailed Description

Provides centralized type lists for use in Google Test type-parameterized tests.

These lists should be used for consistency across tests as well as future-proofing against the addition of any new types in the future.

Definition in file type_lists.hpp.

Typedef Documentation

◆ AllTypes

using cudf::test::AllTypes = typedef Concat<NumericTypes, ChronoTypes, FixedPointTypes>

Provides a list of all types supported in libcudf for use in a GTest typed test.

Note
Currently does not provide any of the "wrapped" types, e.g., category, etc.

Example:

// Invokes all typed fixture tests for all types supported by libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::AllTypes);
Concat< NumericTypes, ChronoTypes, FixedPointTypes > AllTypes
Provides a list of all types supported in libcudf for use in a GTest typed test.
Definition: type_lists.hpp:371

Definition at line 371 of file type_lists.hpp.

◆ ChronoTypes

using cudf::test::ChronoTypes = typedef Concat<TimestampTypes, DurationTypes>

Provides a list of all chrono types supported in libcudf for use in a GTest typed test.

Example:

// Invokes all typed fixture tests for all chrono types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::ChronoTypes);
Concat< TimestampTypes, DurationTypes > ChronoTypes
Provides a list of all chrono types supported in libcudf for use in a GTest typed test.
Definition: type_lists.hpp:256

Definition at line 256 of file type_lists.hpp.

◆ ComparableTypes

using cudf::test::ComparableTypes = typedef Concat<NumericTypes, ChronoTypes, StringTypes>

Provides a list of sortable types for use in GTest typed tests.

Example:

// Invokes all typed fixture tests for all sortable types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::ComparableTypes);
Concat< NumericTypes, ChronoTypes, StringTypes > ComparableTypes
Provides a list of sortable types for use in GTest typed tests.
Definition: type_lists.hpp:344

Definition at line 344 of file type_lists.hpp.

◆ CompoundTypes

Provides a list of all compound types for use in GTest typed tests.

Example:

// Invokes all typed fixture tests for all compound types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::CompoundTypes);
cudf::test::Types< cudf::string_view, cudf::dictionary32, cudf::list_view, cudf::struct_view > CompoundTypes
Provides a list of all compound types for use in GTest typed tests.
Definition: type_lists.hpp:356

Definition at line 355 of file type_lists.hpp.

◆ DurationTypes

using cudf::test::DurationTypes = typedef cudf::test::Types<duration_D, duration_s, duration_ms, duration_us, duration_ns>

Provides a list of all duration types supported in libcudf for use in a GTest typed test.

Example:

// Invokes all typed fixture tests for all duration types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::DurationTypes);
cudf::test::Types< duration_D, duration_s, duration_ms, duration_us, duration_ns > DurationTypes
Provides a list of all duration types supported in libcudf for use in a GTest typed test.
Definition: type_lists.hpp:245

Definition at line 244 of file type_lists.hpp.

◆ FixedPointTypes

Provides a list of all fixed-point element types for use in GTest typed tests.

Example:

// Invokes all typed fixture tests for all fixed-width types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::FixedPointTypes);
cudf::test::Types< numeric::decimal32, numeric::decimal64, numeric::decimal128 > FixedPointTypes
Provides a list of all fixed-point element types for use in GTest typed tests.
Definition: type_lists.hpp:293

Definition at line 292 of file type_lists.hpp.

◆ FixedWidthTypes

using cudf::test::FixedWidthTypes = typedef Concat<NumericTypes, ChronoTypes, FixedPointTypes>

Provides a list of all fixed-width element types for use in GTest typed tests.

Example:

// Invokes all typed fixture tests for all fixed-width types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::FixedWidthTypes);
Concat< NumericTypes, ChronoTypes, FixedPointTypes > FixedWidthTypes
Provides a list of all fixed-width element types for use in GTest typed tests.
Definition: type_lists.hpp:305

Definition at line 305 of file type_lists.hpp.

◆ FixedWidthTypesWithoutChrono

using cudf::test::FixedWidthTypesWithoutChrono = typedef Concat<NumericTypes, FixedPointTypes>

Provides a list of all fixed-width element types except for the chrono types for use in GTest typed tests.

Example:

// Invokes all typed fixture tests for all fixed-width types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::FixedWidthTypesWithoutChrono);
Concat< NumericTypes, FixedPointTypes > FixedWidthTypesWithoutChrono
Provides a list of all fixed-width element types except for the chrono types for use in GTest typed t...
Definition: type_lists.hpp:333

Definition at line 333 of file type_lists.hpp.

◆ FixedWidthTypesWithoutFixedPoint

using cudf::test::FixedWidthTypesWithoutFixedPoint = typedef Concat<NumericTypes, ChronoTypes>

Provides a list of all fixed-width element types except for the fixed-point types for use in GTest typed tests.

Certain tests written for fixed-width types don't work for fixed-point as fixed-point types aren't constructible from other fixed-width types because a scale needs to be specified.

Example:

// Invokes all typed fixture tests for all fixed-width types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::FixedWidthTypesWithoutFixedPoint);
Concat< NumericTypes, ChronoTypes > FixedWidthTypesWithoutFixedPoint
Provides a list of all fixed-width element types except for the fixed-point types for use in GTest ty...
Definition: type_lists.hpp:321

Definition at line 321 of file type_lists.hpp.

◆ FloatingPointTypes

using cudf::test::FloatingPointTypes = typedef cudf::test::Types<float, double>

Provides a list of all floating point types supported in libcudf for use in a GTest typed test.

Example:

// Invokes all typed fixture tests for all floating point types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::FloatingPointTypes);
cudf::test::Types< float, double > FloatingPointTypes
Provides a list of all floating point types supported in libcudf for use in a GTest typed test.
Definition: type_lists.hpp:207

Definition at line 207 of file type_lists.hpp.

◆ ListTypes

using cudf::test::ListTypes = typedef cudf::test::Types<list_view>

Provides a list of all list types supported in libcudf for use in a GTest typed test.

Example:

// Invokes all typed fixture tests for all list types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::ListTypes);
cudf::test::Types< list_view > ListTypes
Provides a list of all list types supported in libcudf for use in a GTest typed test.
Definition: type_lists.hpp:280

Definition at line 280 of file type_lists.hpp.

◆ NumericTypes

using cudf::test::NumericTypes = typedef Concat<IntegralTypes, FloatingPointTypes>

Provides a list of all numeric types supported in libcudf for use in a GTest typed test.

Example:

// Invokes all typed fixture tests for all numeric types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::NumericTypes);
Concat< IntegralTypes, FloatingPointTypes > NumericTypes
Provides a list of all numeric types supported in libcudf for use in a GTest typed test.
Definition: type_lists.hpp:219

Definition at line 219 of file type_lists.hpp.

◆ StringTypes

using cudf::test::StringTypes = typedef cudf::test::Types<string_view>

Provides a list of all string types supported in libcudf for use in a GTest typed test.

Example:

// Invokes all typed fixture tests for all string types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::StringTypes);
cudf::test::Types< string_view > StringTypes
Provides a list of all string types supported in libcudf for use in a GTest typed test.
Definition: type_lists.hpp:268

Definition at line 268 of file type_lists.hpp.

◆ TimestampTypes

using cudf::test::TimestampTypes = typedef cudf::test::Types<timestamp_D, timestamp_s, timestamp_ms, timestamp_us, timestamp_ns>

Provides a list of all timestamp types supported in libcudf for use in a GTest typed test.

Example:

// Invokes all typed fixture tests for all timestamp types in libcudf
TYPED_TEST_SUITE(MyTypedFixture, cudf::test::TimestampTypes);
cudf::test::Types< timestamp_D, timestamp_s, timestamp_ms, timestamp_us, timestamp_ns > TimestampTypes
Provides a list of all timestamp types supported in libcudf for use in a GTest typed test.
Definition: type_lists.hpp:232

Definition at line 231 of file type_lists.hpp.

Function Documentation

◆ make_type_param_scalar() [1/3]

template<typename TypeParam , typename T >
std::enable_if_t<cudf::is_fixed_width<TypeParam>) && !cudf::is_timestamp_t<TypeParam>::value, TypeParam> cudf::test::make_type_param_scalar ( T const  init_value)

Convert the numeric value of type T to a fixed width type of type TypeParam.

This function is necessary because some types (such as timestamp types) are not directly constructible from numeric types. This function is offered as a convenience to allow implicitly constructing such objects from numeric values.

Parameters
init_valueValue used to initialize the fixed width type
Returns
A fixed width type - [u]int32/float/duration etc. of type TypeParam with the value specified

Definition at line 148 of file type_lists.hpp.

◆ make_type_param_scalar() [2/3]

template<typename TypeParam , typename T >
std::enable_if_t<cudf::is_timestamp_t<TypeParam>::value, TypeParam> cudf::test::make_type_param_scalar ( T const  init_value)

Convert the timestamp value of type T to a fixed width type of type TypeParam.

This function is necessary because some types (such as timestamp types) are not directly constructible from timestamp types. This function is offered as a convenience to allow implicitly constructing such objects from timestamp values.

Parameters
init_valueValue used to initialize the fixed width type
Returns
A fixed width type - TimeStamp of type TypeParam with the value specified

Definition at line 165 of file type_lists.hpp.

◆ make_type_param_scalar() [3/3]

template<typename TypeParam , typename T >
std::enable_if_t<std::is_same_v<TypeParam, std::string>, TypeParam> cudf::test::make_type_param_scalar ( T const  init_value)

Convert the numeric value of type T to a string type.

This function converts the numeric value of type T to its string representation.

Parameters
init_valueValue to convert to a string
Returns
string representation of the value

Definition at line 180 of file type_lists.hpp.

◆ make_type_param_vector() [1/3]

template<typename TypeParam , typename T >
std::enable_if_t<cudf::is_fixed_width<TypeParam>) && !cudf::is_timestamp_t<TypeParam>::value, thrust::host_vector<TypeParam> > cudf::test::make_type_param_vector ( std::initializer_list< T > const &  init_list)

Convert numeric values of type T to numeric vector of type TypeParam.

This will also convert negative values to positive values if the output type is unsigned.

Parameters
init_listValues used to create the output vector
Returns
Vector of TypeParam with the values specified

Definition at line 87 of file type_lists.hpp.

◆ make_type_param_vector() [2/3]

template<typename TypeParam , typename T >
std::enable_if_t<cudf::is_timestamp_t<TypeParam>::value, thrust::host_vector<TypeParam> > cudf::test::make_type_param_vector ( std::initializer_list< T > const &  init_list)

Convert numeric values of type T to timestamp vector.

Parameters
init_listValues used to create the output vector
Returns
Vector of TypeParam with the values specified

Definition at line 107 of file type_lists.hpp.

◆ make_type_param_vector() [3/3]

template<typename TypeParam , typename T >
std::enable_if_t<std::is_same_v<TypeParam, std::string>, thrust::host_vector<std::string> > cudf::test::make_type_param_vector ( std::initializer_list< T > const &  init_list)

Convert numeric values of type T to vector of std::string.

Parameters
init_listValues used to create the output vector
Returns
Vector of TypeParam with the values specified

Definition at line 125 of file type_lists.hpp.

◆ types_to_ids()

template<typename TYPES >
constexpr auto cudf::test::detail::types_to_ids ( )
constexpr

Converts a Types list of types into a std::array of the corresponding cudf::type_ids for each type in the list.

Example:

auto array = types_to_ids<Types<int32_t, float>>();
array == {type_id::INT32, type_id::FLOAT};
Template Parameters
TYPESList of types to convert to type_ids
Returns
std::array of type_ids corresponding to each type in TYPES

Definition at line 68 of file type_lists.hpp.