From 1a52152852ff29c727673fc80e8bf8eca5ed6365 Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Thu, 16 Jul 2026 14:08:24 +0530 Subject: starting pos, move count, test pass --- src/uci/command.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'src/uci') 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 -- cgit v1.2.3