Add more tests for command line parser

This commit is contained in:
Alex Kotov 2020-12-02 01:29:45 +05:00
parent 5ad5a1300b
commit 0830f09a80
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#include <kernaux/cmdline.h>
#include <assert.h>
#include <string.h>
static const unsigned int ARGV_COUNT_MAX = 1024;
static const unsigned int ARG_SIZE_MAX = 4096;
@ -8,7 +9,7 @@ static const unsigned int ARG_SIZE_MAX = 4096;
int main()
{
char error_msg[KERNAUX_CMDLINE_ERROR_MSG_SIZE_MAX];
unsigned int argc;
unsigned int argc = 1234;
char *argv[ARGV_COUNT_MAX];
char buffer[ARGV_COUNT_MAX * ARG_SIZE_MAX];
@ -22,5 +23,12 @@ int main()
ARG_SIZE_MAX
));
assert(strcmp(error_msg, "") == 0);
assert(argc == 0);
for (unsigned int index = 0; index < ARGV_COUNT_MAX; ++index) {
assert(argv[index] == KERNAUX_NULL);
}
return 0;
}