diff --git a/test/test_rocrand_generate.cpp b/test/test_rocrand_generate.cpp index 4acc876a..aa64fab6 100644 --- a/test/test_rocrand_generate.cpp +++ b/test/test_rocrand_generate.cpp @@ -69,9 +69,16 @@ TEST_P(rocrand_generate_tests, int_test) TEST_P(rocrand_generate_tests, char_test) { + const size_t size = 12563; + unsigned char* data = nullptr; + rocrand_generator generator = nullptr; + + 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, @@ -79,8 +86,6 @@ TEST_P(rocrand_generate_tests, char_test) ) ); - const size_t size = 12563; - unsigned char * data; HIP_CHECK(hipMallocHelper(&data, size * sizeof(unsigned char))); HIP_CHECK(hipDeviceSynchronize()); @@ -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 = nullptr; + rocrand_generator generator = nullptr; + + 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()); @@ -145,10 +156,9 @@ TEST_P(rocrand_generate_tests, short_test) TEST(rocrand_generate_tests, neg_test) { - const size_t size = 256; - unsigned int * data = NULL; - - rocrand_generator generator = NULL; + const size_t size = 256; + unsigned int* data = nullptr; + rocrand_generator generator = nullptr; EXPECT_EQ( rocrand_generate(generator, (unsigned int *) data, size), ROCRAND_STATUS_NOT_CREATED @@ -164,13 +174,18 @@ class rocrand_generate_long_long_tests : public ::testing::TestWithParam