call functions with invalid parameters */
| 1178 | |
| 1179 | /* call functions with invalid parameters */ |
| 1180 | int |
| 1181 | test_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) |
no test coverage detected