This is a test plan for sycl::bit_cast
operation defined in
3.9.2. Alignment with future versions of C++.
Test described below are performed only on the default device that is selected on the CTS command line.
Define To
and From
as:
-
To
- returned value ofsycl::bit_cast
opeartion -
From
- the source of bits for the return value
Test is performed for following types for To
and From
:
-
T
-
T[2]
-
class Base with a non-static member variable of type T
-
class Derived with non-virtual base class Base
For following T
in regular mode:
-
int
-
float
-
bool
-
pointers to above types
For following T
in full conformance mode:
-
bool
-
char
-
signed char
-
unsigned char
-
short
-
unsigned short
-
int
-
unsigned int
-
long
-
unsigned long
-
long long
-
unsigned long long
-
float
-
double
-
pointers to above types
Test is performed for all valid combinations of To
and From
types i.e. for types which size is equal.
Test is skipped if the To
type is set to T[2]
due to array can’t be a returned type and if To
type
is set to bool
since it can lead to undefined behavior (bool
can only take 2 values).
-
Define kernel as a lambda function
-
In this lambda function create variable
From
of one type from type list above and variableTo
of different tested type -
Initialize variable
From
by predefinedexpected_val
value -
Assign variable
To
value returned bysycl::bit_cast<type_of_To>(From)
-
Check that memory contents of variables
To
andFrom
are equal usingmemcmp
-
Assign variable
From
value returned bysycl::bit_cast<type_of_From>(To)
-
Check that value of variable
From
is equal toexpected_val