| 49 | /****************************************************************/ |
| 50 | |
| 51 | static int |
| 52 | test_cmdline_parse_fns(void) |
| 53 | { |
| 54 | struct cmdline *cl; |
| 55 | cmdline_parse_ctx_t ctx; |
| 56 | int i = 0; |
| 57 | char dst[CMDLINE_TEST_BUFSIZE]; |
| 58 | |
| 59 | cl = cmdline_new(&ctx, "prompt", -1, -1); |
| 60 | if (cl == NULL) { |
| 61 | printf("Error: cannot create cmdline to test parse fns!\n"); |
| 62 | return -1; |
| 63 | } |
| 64 | |
| 65 | if (cmdline_parse(NULL, "buffer") >= 0) |
| 66 | goto error; |
| 67 | if (cmdline_parse(cl, NULL) >= 0) |
| 68 | goto error; |
| 69 | |
| 70 | if (cmdline_complete(NULL, "buffer", &i, dst, sizeof(dst)) >= 0) |
| 71 | goto error; |
| 72 | if (cmdline_complete(cl, NULL, &i, dst, sizeof(dst)) >= 0) |
| 73 | goto error; |
| 74 | if (cmdline_complete(cl, "buffer", NULL, dst, sizeof(dst)) >= 0) |
| 75 | goto error; |
| 76 | if (cmdline_complete(cl, "buffer", &i, NULL, sizeof(dst)) >= 0) |
| 77 | goto error; |
| 78 | |
| 79 | cmdline_free(cl); |
| 80 | return 0; |
| 81 | |
| 82 | error: |
| 83 | printf("Error: function accepted null parameter!\n"); |
| 84 | cmdline_free(cl); |
| 85 | return -1; |
| 86 | } |
| 87 | |
| 88 | static int |
| 89 | test_cmdline_rdline_fns(void) |
no test coverage detected