diff options
Diffstat (limited to '02_exercise/process_test.c')
-rw-r--r-- | 02_exercise/process_test.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/02_exercise/process_test.c b/02_exercise/process_test.c index 591a06f..d7e59a4 100644 --- a/02_exercise/process_test.c +++ b/02_exercise/process_test.c @@ -53,11 +53,33 @@ void test_ls(){ free_processes(&processes); } -/* +void test_multiparse() { + Process *processes = NULL; + parse_line("echo abcdefg", &processes); + assert(arrayLen(processes) == 1); + Process p = processes[0]; + assert(arrayLen(p.argv)==3); + assert(p.argc == 2); + assert(strcmp(p.argv[0], "echo") == 0); + assert(strcmp(p.argv[1], "abcdefg") == 0); + assert(p.argc[p.argv] == NULL); + free_processes(&processes); + parse_line("echo abc", &processes); + assert(arrayLen(processes) == 1); + p = processes[0]; + assert(arrayLen(p.argv)==3); + assert(p.argc == 2); + assert(strcmp(p.argv[0], "echo") == 0); + assert(strcmp(p.argv[1], "abc") == 0); + assert(p.argc[p.argv] == NULL); +} + + int main() { test_ls(); test_simple_case(); test_detached(); test_pipe(); + test_multiparse(); return 0; -}*/ +} |