summaryrefslogtreecommitdiff
path: root/src/uci/command.c
diff options
context:
space:
mode:
authorAargh Rai <aargh.rai+git@gmail.com>2026-07-16 14:08:24 +0530
committerAargh Rai <aargh.rai+git@gmail.com>2026-07-16 14:08:24 +0530
commit1a52152852ff29c727673fc80e8bf8eca5ed6365 (patch)
treee719771aa1b23f0b8774814ee907057f86f1dda1 /src/uci/command.c
parent6ac448727e1e26c78055eaaa361217f64393d808 (diff)
starting pos, move count, test pass
Diffstat (limited to 'src/uci/command.c')
-rw-r--r--src/uci/command.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/uci/command.c b/src/uci/command.c
index c64fee2..583b887 100644
--- a/src/uci/command.c
+++ b/src/uci/command.c
@@ -101,25 +101,42 @@ bool test_uci_cmd_t() {
uci_cmd_append_arg(&cmd, "arg2");
uci_cmd_append_arg(&cmd, "arg3");
- if (strncmp(cmd.root, "root", MAX_TOKEN_SIZE) != 0) return false;
- if (strncmp(uci_cmd_get_arg(cmd, 0), "arg1", MAX_TOKEN_SIZE) != 0)
+ if (strncmp(cmd.root, "root", MAX_TOKEN_SIZE) != 0) {
+ uci_cmd_deinit(cmd);
return false;
- if (strncmp(uci_cmd_get_arg(cmd, 1), "arg2", MAX_TOKEN_SIZE) != 0)
+ }
+ if (strncmp(uci_cmd_get_arg(cmd, 0), "arg1", MAX_TOKEN_SIZE) != 0) {
+ uci_cmd_deinit(cmd);
return false;
- if (strncmp(uci_cmd_get_arg(cmd, 2), "arg3", MAX_TOKEN_SIZE) != 0)
+ }
+ if (strncmp(uci_cmd_get_arg(cmd, 1), "arg2", MAX_TOKEN_SIZE) != 0) {
+ uci_cmd_deinit(cmd);
return false;
+ }
+ if (strncmp(uci_cmd_get_arg(cmd, 2), "arg3", MAX_TOKEN_SIZE) != 0) {
+ uci_cmd_deinit(cmd);
+ return false;
+ }
+ uci_cmd_deinit(cmd);
return true;
}
bool test_invalid_cmd_uci_cmd_t() {
- uci_cmd_t cmd = uci_cmd_t_init();
+ uci_cmd_t cmd = uci_cmd_init();
+
uci_cmd_add(&cmd, "john");
uci_cmd_add(&cmd, "debug");
uci_cmd_add(&cmd, "on");
- if (strncmp(cmd.root, "debug", MAX_TOKEN_SIZE) != 0) return false;
- if (strncmp(uci_cmd_t_get_arg(cmd, 0), "on", MAX_TOKEN_SIZE) != 0)
+ if (strncmp(cmd.root, "debug", MAX_TOKEN_SIZE) != 0) {
+ uci_cmd_deinit(cmd);
return false;
+ }
+ if (strncmp(uci_cmd_get_arg(cmd, 0), "on", MAX_TOKEN_SIZE) != 0) {
+ uci_cmd_deinit(cmd);
+ return false;
+ }
+ uci_cmd_deinit(cmd);
return true;
}
#endif