Skip to content

Commit eea6888

Browse files
committed
Move from char to signed char in most of the tests.
Most of these tests were written solely for int and short; both of those types are signed. `char` is signed on x86, but unsigned on some of the platforms that we care about, so we got test failures on those platforms, caused by signed->unsigned conversions. The intention was to use a one byte signed type; signed char is a better expression of this idea. Bug 2454176 Bug 2462155 Bug 2463408 Bug 200468907 Bug 200472127 Bug 200472868
1 parent 4218fb0 commit eea6888

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

testing/unittest/testframework.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ inline void chop_prefix(std::string& str, const std::string& prefix)
278278
inline std::string base_class_name(const std::string& name)
279279
{
280280
std::string result = name;
281-
281+
282282
// if the name begins with "struct ", chop it off
283283
chop_prefix(result, "struct ");
284-
284+
285285
// if the name begins with "class ", chop it off
286286
chop_prefix(result, "class ");
287287

@@ -307,7 +307,7 @@ class UnitTest {
307307
virtual ~UnitTest() {}
308308
virtual void run() {}
309309

310-
bool operator<(const UnitTest& u) const
310+
bool operator<(const UnitTest& u) const
311311
{
312312
return name < u.name;
313313
}
@@ -335,7 +335,7 @@ class UnitTestDriver
335335

336336
void register_test(UnitTest * test);
337337
virtual bool run_tests(const ArgumentSet& args, const ArgumentMap& kwargs);
338-
void list_tests(void);
338+
void list_tests(void);
339339

340340
static UnitTestDriver &s_driver();
341341
};
@@ -355,7 +355,7 @@ TEST##UnitTest TEST##Instance
355355
// unit test for a bunch of data types
356356
#define DECLARE_VECTOR_UNITTEST(VTEST) \
357357
void VTEST##Host(void) { \
358-
VTEST< thrust::host_vector<char> >(); \
358+
VTEST< thrust::host_vector<signed char> >(); \
359359
VTEST< thrust::host_vector<short> >(); \
360360
VTEST< thrust::host_vector<int> >(); \
361361
VTEST< thrust::host_vector<float> >(); \
@@ -366,7 +366,7 @@ void VTEST##Host(void) { \
366366
thrust::host_memory_resource> > >(); \
367367
} \
368368
void VTEST##Device(void) { \
369-
VTEST< thrust::device_vector<char> >(); \
369+
VTEST< thrust::device_vector<signed char> >(); \
370370
VTEST< thrust::device_vector<short> >(); \
371371
VTEST< thrust::device_vector<int> >(); \
372372
VTEST< thrust::device_vector<float> >(); \
@@ -388,12 +388,12 @@ DECLARE_UNITTEST(VTEST##Device);
388388
// Same as above, but only for integral types
389389
#define DECLARE_INTEGRAL_VECTOR_UNITTEST(VTEST) \
390390
void VTEST##Host(void) { \
391-
VTEST< thrust::host_vector<char> >(); \
391+
VTEST< thrust::host_vector<signed char> >(); \
392392
VTEST< thrust::host_vector<short> >(); \
393393
VTEST< thrust::host_vector<int> >(); \
394394
} \
395395
void VTEST##Device(void) { \
396-
VTEST< thrust::device_vector<char> >(); \
396+
VTEST< thrust::device_vector<signed char> >(); \
397397
VTEST< thrust::device_vector<short> >(); \
398398
VTEST< thrust::device_vector<int> >(); \
399399
} \
@@ -407,7 +407,7 @@ class TEST##UnitTest : public UnitTest { \
407407
TEST##UnitTest() : UnitTest(#TEST) {} \
408408
void run() \
409409
{ \
410-
TEST<char>(); \
410+
TEST<signed char>(); \
411411
TEST<unsigned char>(); \
412412
TEST<short>(); \
413413
TEST<unsigned short>(); \
@@ -428,7 +428,7 @@ class TEST##UnitTest : public UnitTest { \
428428
std::vector<size_t> sizes = get_test_sizes(); \
429429
for(size_t i = 0; i != sizes.size(); ++i) \
430430
{ \
431-
TEST<char>(sizes[i]); \
431+
TEST<signed char>(sizes[i]); \
432432
TEST<unsigned char>(sizes[i]); \
433433
TEST<short>(sizes[i]); \
434434
TEST<unsigned short>(sizes[i]); \
@@ -450,7 +450,7 @@ class TEST##UnitTest : public UnitTest { \
450450
std::vector<size_t> sizes = get_test_sizes(); \
451451
for(size_t i = 0; i != sizes.size(); ++i) \
452452
{ \
453-
TEST<char>(sizes[i]); \
453+
TEST<signed char>(sizes[i]); \
454454
TEST<unsigned char>(sizes[i]); \
455455
TEST<short>(sizes[i]); \
456456
TEST<unsigned short>(sizes[i]); \

0 commit comments

Comments
 (0)