MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_cirbuf_invalid_param

Function test_cirbuf_invalid_param

dpdk/app/test/test_cmdline_cirbuf.c:1180–1248  ·  view source on GitHub ↗

call functions with invalid parameters */

Source from the content-addressed store, hash-verified

1178
1179/* call functions with invalid parameters */
1180int
1181test_cirbuf_invalid_param(void)
1182{
1183 struct cirbuf cb;
1184 char buf[CMDLINE_TEST_BUFSIZE];
1185
1186 /* null cirbuf */
1187 if (cirbuf_init(0, buf, 0, sizeof(buf)) == 0)
1188 return -1;
1189 /* null buffer */
1190 if (cirbuf_init(&cb, 0, 0, sizeof(buf)) == 0)
1191 return -1;
1192 /* null cirbuf */
1193 if (cirbuf_add_head_safe(0, 'h') == 0)
1194 return -1;
1195 if (cirbuf_add_tail_safe(0, 't') == 0)
1196 return -1;
1197 if (cirbuf_del_head_safe(0) == 0)
1198 return -1;
1199 if (cirbuf_del_tail_safe(0) == 0)
1200 return -1;
1201 /* null buffer */
1202 if (cirbuf_add_buf_head(&cb, 0, 0) == 0)
1203 return -1;
1204 if (cirbuf_add_buf_tail(&cb, 0, 0) == 0)
1205 return -1;
1206 /* null cirbuf */
1207 if (cirbuf_add_buf_head(0, buf, 0) == 0)
1208 return -1;
1209 if (cirbuf_add_buf_tail(0, buf, 0) == 0)
1210 return -1;
1211 /* null size */
1212 if (cirbuf_add_buf_head(&cb, buf, 0) == 0)
1213 return -1;
1214 if (cirbuf_add_buf_tail(&cb, buf, 0) == 0)
1215 return -1;
1216 /* null cirbuf */
1217 if (cirbuf_del_buf_head(0, 0) == 0)
1218 return -1;
1219 if (cirbuf_del_buf_tail(0, 0) == 0)
1220 return -1;
1221 /* null size */
1222 if (cirbuf_del_buf_head(&cb, 0) == 0)
1223 return -1;
1224 if (cirbuf_del_buf_tail(&cb, 0) == 0)
1225 return -1;
1226 /* null cirbuf */
1227 if (cirbuf_get_buf_head(0, 0, 0) == 0)
1228 return -1;
1229 if (cirbuf_get_buf_tail(0, 0, 0) == 0)
1230 return -1;
1231 /* null buffer */
1232 if (cirbuf_get_buf_head(&cb, 0, 0) == 0)
1233 return -1;
1234 if (cirbuf_get_buf_tail(&cb, 0, 0) == 0)
1235 return -1;
1236 /* null size, this is valid but should return 0 */
1237 if (cirbuf_get_buf_head(&cb, buf, 0) != 0)

Callers 1

test_cmdlineFunction · 0.85

Calls 13

cirbuf_initFunction · 0.85
cirbuf_add_head_safeFunction · 0.85
cirbuf_add_tail_safeFunction · 0.85
cirbuf_del_head_safeFunction · 0.85
cirbuf_del_tail_safeFunction · 0.85
cirbuf_add_buf_headFunction · 0.85
cirbuf_add_buf_tailFunction · 0.85
cirbuf_del_buf_headFunction · 0.85
cirbuf_del_buf_tailFunction · 0.85
cirbuf_get_buf_headFunction · 0.85
cirbuf_get_buf_tailFunction · 0.85
cirbuf_align_leftFunction · 0.85

Tested by

no test coverage detected