Skip to content

Commit 2b17b04

Browse files
Update test_network.cpp
1 parent d1739ab commit 2b17b04

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

code/tests/cases/test_network.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,9 @@ FOSSIL_TEST_CASE(cpp_test_nstream_ssl_send_recv) {
156156
/**
157157
* Test cases for the C++ NStream wrapper class.
158158
*/
159-
FOSSIL_TEST_CASE(cpp_test_nstream_class_open) {
160-
fossil::io::NStream ns("tcp", "127.0.0.1", "8080", "");
161-
ASSUME_NOT_CNULL(ns);
162-
}
163159

164160
FOSSIL_TEST_CASE(cpp_test_nstream_class_send_recv) {
165161
fossil::io::NStream ns("tcp", "127.0.0.1", "8080", "");
166-
ASSUME_NOT_CNULL(ns);
167162

168163
const std::string message = "Hello, Fossil!";
169164
ssize_t bytes_sent = ns.send(message.c_str(), message.size());
@@ -177,28 +172,24 @@ FOSSIL_TEST_CASE(cpp_test_nstream_class_send_recv) {
177172

178173
FOSSIL_TEST_CASE(cpp_test_nstream_class_listen_accept) {
179174
fossil::io::NStream server("tcp", "127.0.0.1", "8080", "");
180-
ASSUME_NOT_CNULL(server);
181175

182176
int result = server.listen(5);
183177
ASSUME_ITS_EQUAL_I32(0, result);
184178

185179
fossil::io::NStream *client = server.accept();
186-
ASSUME_NOT_CNULL(client);
187180

188181
delete client;
189182
}
190183

191184
FOSSIL_TEST_CASE(cpp_test_nstream_class_set_nonblocking) {
192185
fossil::io::NStream ns("tcp", "127.0.0.1", "8080", "");
193-
ASSUME_NOT_CNULL(ns);
194186

195187
int result = ns.set_non_blocking(1);
196188
ASSUME_ITS_EQUAL_I32(0, result);
197189
}
198190

199191
FOSSIL_TEST_CASE(cpp_test_nstream_class_wait_readable_writable) {
200192
fossil::io::NStream ns("tcp", "127.0.0.1", "8080", "");
201-
ASSUME_NOT_CNULL(ns);
202193

203194
int result = ns.wait_readable(1000);
204195
ASSUME_ITS_TRUE(result == 0 || result == 1);
@@ -209,15 +200,13 @@ FOSSIL_TEST_CASE(cpp_test_nstream_class_wait_readable_writable) {
209200

210201
FOSSIL_TEST_CASE(cpp_test_nstream_class_connect_timeout) {
211202
fossil::io::NStream ns("tcp", "", "", "");
212-
ASSUME_NOT_CNULL(ns);
213203

214204
int result = ns.connect_timeout("127.0.0.1", "8080", 1000);
215205
ASSUME_ITS_EQUAL_I32(0, result);
216206
}
217207

218208
FOSSIL_TEST_CASE(cpp_test_nstream_class_get_peer_info) {
219209
fossil::io::NStream ns("tcp", "127.0.0.1", "8080", "");
220-
ASSUME_NOT_CNULL(ns);
221210

222211
std::string ip_str;
223212
uint16_t port;
@@ -227,7 +216,6 @@ FOSSIL_TEST_CASE(cpp_test_nstream_class_get_peer_info) {
227216

228217
FOSSIL_TEST_CASE(cpp_test_nstream_class_send_recv_line) {
229218
fossil::io::NStream ns("tcp", "127.0.0.1", "8080", "");
230-
ASSUME_NOT_CNULL(ns);
231219

232220
const std::string line = "Hello, Fossil Logic!\n";
233221
ssize_t bytes_sent = ns.send_line(line);
@@ -253,5 +241,14 @@ FOSSIL_TEST_GROUP(cpp_network_tests) {
253241
FOSSIL_TEST_ADD(cpp_network_suite, cpp_test_nstream_send_recv_line);
254242
FOSSIL_TEST_ADD(cpp_network_suite, cpp_test_nstream_ssl_send_recv);
255243

244+
FOSSIL_TEST_ADD(cpp_network_suite, cpp_test_nstream_class_send_recv);
245+
FOSSIL_TEST_ADD(cpp_network_suite, cpp_test_nstream_class_listen_accept);
246+
FOSSIL_TEST_ADD(cpp_network_suite, cpp_test_nstream_class_set_nonblocking);
247+
FOSSIL_TEST_ADD(cpp_network_suite, cpp_test_nstream_class_wait_readable_writable);
248+
FOSSIL_TEST_ADD(cpp_network_suite, cpp_test_nstream_class_connect_timeout);
249+
FOSSIL_TEST_ADD(cpp_network_suite, cpp_test_nstream_class_get_peer_info);
250+
FOSSIL_TEST_ADD(cpp_network_suite, cpp_test_nstream_class_send_recv_line);
251+
FOSSIL_TEST_ADD(cpp_network_suite, cpp_test_nstream_class_ssl_send_recv);
252+
256253
FOSSIL_TEST_REGISTER(cpp_network_suite);
257254
}

0 commit comments

Comments
 (0)