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

Function test_cmdline_parse_fns

dpdk/app/test/test_cmdline_lib.c:51–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49/****************************************************************/
50
51static int
52test_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
82error:
83 printf("Error: function accepted null parameter!\n");
84 cmdline_free(cl);
85 return -1;
86}
87
88static int
89test_cmdline_rdline_fns(void)

Callers 1

test_cmdline_libFunction · 0.85

Calls 5

cmdline_newFunction · 0.85
cmdline_parseFunction · 0.85
cmdline_completeFunction · 0.85
cmdline_freeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected