Skip to content

Commit 3553ebf

Browse files
committedFeb 24, 2025
test: Add port validation check after openURL
1 parent 03c0615 commit 3553ebf

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed
 

‎test/test-device-ping1d.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ int main(int argc, char* argv[])
1818
}
1919

2020
auto port = AbstractLink::openUrl(CommandLine::self()->connectionString);
21+
if (!port) {
22+
std::cerr << "Failed to open communication link with device" << std::endl;
23+
return -1;
24+
}
2125
Ping1d device = Ping1d(*port.get());
2226

2327
// Basic information

‎test/test-device-ping360.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ int main(int argc, char* argv[])
1818
}
1919

2020
auto port = AbstractLink::openUrl(CommandLine::self()->connectionString);
21+
if (!port) {
22+
std::cerr << "Failed to open communication link with device" << std::endl;
23+
return -1;
24+
}
2125
Ping360 device = Ping360(*port.get());
2226

2327
// Basic information

‎test/test-device.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ int main(int argc, char* argv[])
1919
}
2020

2121
auto port = AbstractLink::openUrl(CommandLine::self()->connectionString);
22+
if (!port) {
23+
std::cerr << "Failed to open communication link with device" << std::endl;
24+
return -1;
25+
}
2226
PingDevice device = PingDevice(*port.get());
2327

2428
// Basic information

0 commit comments

Comments
 (0)