Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed NULL check #492

Closed
wants to merge 7 commits into from
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions test/test_rocrand_generate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,23 @@ TEST_P(rocrand_generate_tests, int_test)

TEST_P(rocrand_generate_tests, char_test)
{
const size_t size = 12563;
unsigned char * data = NULL;
rponnuru5 marked this conversation as resolved.
Show resolved Hide resolved
rocrand_generator generator = NULL;

EXPECT_EQ(
rocrand_generate_char(generator, (unsigned char *) data, size),
ROCRAND_STATUS_NOT_CREATED
);
const rocrand_rng_type rng_type = GetParam();

rocrand_generator generator;
ROCRAND_CHECK(
rocrand_create_generator(
&generator,
rng_type
)
);

const size_t size = 12563;
unsigned char * data;
HIP_CHECK(hipMallocHelper(&data, size * sizeof(unsigned char)));
HIP_CHECK(hipDeviceSynchronize());

Expand All @@ -107,18 +112,24 @@ TEST_P(rocrand_generate_tests, char_test)

TEST_P(rocrand_generate_tests, short_test)
{
const size_t size = 12563;
unsigned short * data = NULL;
rocrand_generator generator = NULL;

EXPECT_EQ(
rocrand_generate_short(generator, (unsigned short *) data, size),
ROCRAND_STATUS_NOT_CREATED
);

const rocrand_rng_type rng_type = GetParam();

rocrand_generator generator;
ROCRAND_CHECK(
ROCRAND_CHECK(
rocrand_create_generator(
&generator,
rng_type
)
);

const size_t size = 12563;
unsigned short * data;
HIP_CHECK(hipMallocHelper(&data, size * sizeof(unsigned short)));
HIP_CHECK(hipDeviceSynchronize());

Expand Down Expand Up @@ -164,13 +175,18 @@ class rocrand_generate_long_long_tests : public ::testing::TestWithParam<rocrand

TEST_P(rocrand_generate_long_long_tests, long_long_test)
{
const size_t size = 12563;
unsigned long long int* data = NULL;
rocrand_generator generator = NULL;
EXPECT_EQ(
rocrand_generate_long_long(generator, (unsigned long long *) data, size),
ROCRAND_STATUS_NOT_CREATED
);

const rocrand_rng_type rng_type = GetParam();

rocrand_generator generator;
ROCRAND_CHECK(rocrand_create_generator(&generator, rng_type));

const size_t size = 12563;
unsigned long long int* data;
HIP_CHECK(hipMallocHelper(&data, size * sizeof(unsigned long long int)));
HIP_CHECK(hipDeviceSynchronize());

Expand Down