Skip to content

Commit a72c004

Browse files
Add test for DPCTLQueue_Create for some nullptr args
1 parent 5a00660 commit a72c004

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

libsyclinterface/tests/test_sycl_queue_interface.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,34 @@ struct TestDPCTLQueueMemberFunctions
9090

9191
} /* End of anonymous namespace */
9292

93+
TEST(TestDPCTLSyclQueueInterface, CheckCreate)
94+
{
95+
/* We are testing that we do not crash even when input is NULL. */
96+
DPCTLSyclQueueRef QRef = nullptr;
97+
98+
EXPECT_NO_FATAL_FAILURE(
99+
QRef = DPCTLQueue_Create(nullptr, nullptr, nullptr, 0));
100+
ASSERT_TRUE(QRef == nullptr);
101+
}
102+
103+
TEST(TestDPCTLSyclQueueInterface, CheckCreate2)
104+
{
105+
/* We are testing that we do not crash even when input is NULL. */
106+
DPCTLSyclQueueRef QRef = nullptr;
107+
DPCTLSyclDeviceSelectorRef DSRef = nullptr;
108+
DPCTLSyclDeviceRef DRef = nullptr;
109+
110+
EXPECT_NO_FATAL_FAILURE(DSRef = DPCTLDefaultSelector_Create());
111+
EXPECT_NO_FATAL_FAILURE(DRef = DPCTLDevice_CreateFromSelector(DSRef));
112+
EXPECT_NO_FATAL_FAILURE(DPCTLDeviceSelector_Delete(DSRef));
113+
114+
EXPECT_NO_FATAL_FAILURE(QRef =
115+
DPCTLQueue_Create(nullptr, DRef, nullptr, 0));
116+
ASSERT_TRUE(QRef == nullptr);
117+
118+
EXPECT_NO_FATAL_FAILURE(DPCTLDevice_Delete(DRef));
119+
}
120+
93121
TEST(TestDPCTLSyclQueueInterface, CheckCreateForDevice)
94122
{
95123
/* We are testing that we do not crash even when input is NULL. */

0 commit comments

Comments
 (0)