summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjakob <jakob@memeware.net>2017-04-12 16:54:36 -0400
committerjakob <jakob@memeware.net>2017-04-12 16:54:36 -0400
commit07347dcaa361607a924178eff787177e8cca6d68 (patch)
tree5109650cbaf0a8ff5a9dadad5ab912f1cf59911d /test
parent411a40b5c077ca69e34c7016428eb9d856f8fe73 (diff)
Expanded tests for the command-line interface.
Diffstat (limited to 'test')
-rw-r--r--test/test_cli.c24
-rw-r--r--test/test_cli.h2
-rw-r--r--test/test_run.c2
3 files changed, 27 insertions, 1 deletions
diff --git a/test/test_cli.c b/test/test_cli.c
index 5a5f0db..00cc84e 100644
--- a/test/test_cli.c
+++ b/test/test_cli.c
@@ -22,11 +22,33 @@
#include "minunit.h"
#include "cli.h"
+#include "crypto.h"
+
+extern int tests_run;
char *test_out_path(void) {
- char *argv[4] = {"nekopack", "-o", "/tmp", "a.xp3"};
+ char *argv[] = {"nekopack", "-o", "/tmp", "a.xp3"};
struct params p = parse_args(4, argv);
mu_assert("Trailing slash not appended to path", !strcmp(p.out, "/tmp/"));
+ params_free(p);
+ return NULL;
+}
+
+
+char *test_vararg_index(void) {
+ char *argv[] = {"nekopack", "-l", "a.xp3"};
+ struct params p = parse_args(3, argv);
+ mu_assert("Invalid vararg index", !strcmp("a.xp3", argv[p.vararg_index]));
+ params_free(p);
+ return NULL;
+}
+
+
+char *test_game_id(void) {
+ char *argv[] = {"nekopack", "-g", "nekopara_volume_1", "a.xp3"};
+ struct params p = parse_args(4, argv);
+ mu_assert("Incorrect game ID", p.game == NEKOPARA_VOLUME_1);
+ params_free(p);
return NULL;
}
diff --git a/test/test_cli.h b/test/test_cli.h
index e580236..f16c50b 100644
--- a/test/test_cli.h
+++ b/test/test_cli.h
@@ -20,3 +20,5 @@
#pragma once
char *test_out_path(void);
+char *test_vararg_index(void);
+char *test_game_id(void);
diff --git a/test/test_run.c b/test/test_run.c
index 04099d4..b63bcb5 100644
--- a/test/test_run.c
+++ b/test/test_run.c
@@ -33,6 +33,8 @@ int tests_run = 0;
static char *run_all_tests(void) {
mu_run_test(test_out_path);
+ mu_run_test(test_vararg_index);
+ mu_run_test(test_game_id);
mu_run_test(test_derive_initial);
mu_run_test(test_derive_primary);
mu_run_test(test_stream_obj);