This is a test plan for deduction guides functionality of classes with templates, such as buffer, multi_ptr, range, id and vec.
All of the tests described below are performed only on the default device that is selected on the CTS command line if not stated otherwise.
All of the tests for buffer
and multi_ptr
described below are performed using each of the following typename T
:
In Regular mode:
-
int
-
float
-
A user-defined class with several scalar member variables and a user-defined default constructor.
In full conformance mode:
-
char
-
signed char
-
unsigned char
-
short int
-
unsigned short int
-
unsigned int
-
long int
-
unsigned long int
-
long long int
-
unsigned long long int
-
bool
-
A user-defined struct with several scalar member variables, no constructor, destructor or member functions.
-
A user-defined class with several scalar member variables, a deleted default constructor, and a user-defined (non-default) constructor.
Tests for vec
are performed using char
, unsigned char
, short
, unsigned short
, int
, unsigned int
, long
, unsigned long
and float
.
Check that constructing an object without specifying template variables initializes object with correct InputIterator
, AllocatorT
, range<Dimensions>
and Container
classes.
-
Create
std::vector<T>
withT
from Types coverage -
Create
buffer
using following constructors without templates using-
InputIterator
-std::vector<T>::begin()
andstd::vector<T>::end()
-
Allocator
-sycl::buffer_allocator
andstd::allocator
-
Container
- existingstd::vector<T>
-
Dimensions
from 1 to 3
-
-
template <class InputIterator, class AllocatorT>
buffer(InputIterator, InputIterator, AllocatorT, const property_list& = {}) → buffer<typename std::iterator_traits<InputIterator>::value_type, 1, AllocatorT>; -
template <class InputIterator>
buffer(InputIterator, InputIterator, const property_list& = {}) → buffer<typename std::iterator_traits<InputIterator>::value_type, 1>; -
template <class T, int Dimensions, class AllocatorT>
buffer(const T*, const range<Dimensions>&, AllocatorT, const property_list& = {}) → buffer<T, Dimensions, AllocatorT>; -
template <class T, int Dimensions>
buffer(const T*, const range<Dimensions>&, const property_list& = {}) → buffer<T, Dimensions>; -
template <class Container, class AllocatorT>
buffer(Container&, AllocatorT, const property_list& = {}) → buffer<typename Container::value_type, 1, AllocatorT>; -
template <class Container>
buffer(Container&, const property_list& = {}) → buffer<typename Container::value_type, 1>; -
Using
std::is_same_v
compare resulting object with expected type from deduction guide.
Additionaly, use buffer
member functions to:
-
Check that
value_type
is the same withT
-
Check that
get_range()
returns samerange<Dimensions>
-
Check that
get_allocator()
returns sameAllocatorT
Check that constructing an object without specifying template variables initializes object with correct T
, access_mode
, placeholder
and Dimensions
classes.
-
Create
accessor
andlocal_accessor
using-
T
from Types coverage -
Dimensions
from 1 to 3 -
Mode
foraccessor
-access::mode::read
,access::mode::write
,access::mode::read_write
-
-
Create
multi_ptr
using following constructors without specifying templates with existingaccessor
andlocal_accessor
.-
template <int Dimensions, access_mode Mode, access::placeholder IsPlaceholder,class T>
multi_ptr(accessor<T, Dimensions, Mode, target::device, IsPlaceholder>) → multi_ptr<T, access::address_space::global_space, access::decorated::no>; -
template <int Dimensions, access_mode Mode, access::placeholder IsPlaceholder, class T>
multi_ptr(local_accessor<T, Dimensions>) → multi_ptr<T, access::address_space::local_space, access::decorated::no>;
-
-
Using
std::is_same_v
compare resulting object with expected type from deduction guide.
Check that constructing an object without specifying Dimensions
passes correct number of size_t
arguments.
-
Create
range
andid
objects using following constructors-
range(size_t N) → range<1>;
-
range(size_t N1, size_t N2) → range<2>;
-
range(size_t N1, size_t N2, size_t N3) → range<3>;
-
id(size_t N)→id<1>;
-
id(size_t N1, size_t N2)→id<2>;
-
id(size_t N1, size_t N2, size_t N3)→id<3>;
-
-
With
N, N1 = 4
,N2 = 8
,N3 = 10
, check thatsize()
of resultingrange
object isN
,N1 * N2
,N1 * N2 * N3
respectively. -
Using
operator[]
ofrange
andid
, check that every element inside object is same with passed. -
Using
std::is_same_v
compare type of resulting object and type with specifiedDimesions
template.
-
Since
NumElement
ofvec
can only be 1, 2, 3, 4, 8 and 16, create sets of data with mentioned number of elements and types from Types coverage. -
Create
vec
using following constructor and passing created sets of data-
template <class T, class… U> vec(T, U…) → vec<T, sizeof…(U) + 1>;
-
-
Using
std::is_same_v
compare resulting object with expected type from deduction guide. -
Use
for
loop to check that elements inside vectors are the same with passed.