parent
ae06ca2afc
commit
11cfb3ce22
6 changed files with 78 additions and 14 deletions
@ -0,0 +1,18 @@ |
||||
#include<stdio.h> |
||||
#include<string.h> |
||||
|
||||
int main(int argc, char **argv) { |
||||
if(argc != 3) { |
||||
fprintf(stderr, "Incorrect number of arguments.\n"); |
||||
return 1; |
||||
} |
||||
if(strcmp(argv[1], "first") != 0) { |
||||
fprintf(stderr, "First argument is wrong.\n"); |
||||
return 1; |
||||
} |
||||
if(strcmp(argv[2], "second") != 0) { |
||||
fprintf(stderr, "Second argument is wrong.\n"); |
||||
return 1; |
||||
} |
||||
return 0; |
||||
} |
@ -0,0 +1,15 @@ |
||||
#include<stdio.h> |
||||
#include<string.h> |
||||
#include<stdlib.h> |
||||
|
||||
int main(int argc, char **argv) { |
||||
if(strcmp(getenv("first"), "val1") != 0) { |
||||
fprintf(stderr, "First envvar is wrong.\n"); |
||||
return 1; |
||||
} |
||||
if(strcmp(getenv("second"), "val2") != 0) { |
||||
fprintf(stderr, "Second envvar is wrong.\n"); |
||||
return 1; |
||||
} |
||||
return 0; |
||||
} |
@ -0,0 +1,7 @@ |
||||
project('test features', 'c') |
||||
|
||||
e1 = executable('cmd_args', 'cmd_args.c') |
||||
e2 = executable('envvars', 'envvars.c') |
||||
|
||||
test('command line arguments', e1, args : ['first', 'second']) |
||||
test('environment variables', e2, env : ['first=val1', 'second=val2']) |
Loading…
Reference in new issue