- Move CLI internal headers to `includes/internal/cli/` - Split CLI handler and parsing declarations across dedicated internal headers - Move handler map to `option_map.c` and properly update references - Relocate CLI utility source and test files from `utils` to `parse_utils` - Refactor `cli.h` to only expose the public interface, move internal typedefs/functions out - Update build system: add conditional git commit detection
24 lines
539 B
C
24 lines
539 B
C
#include <criterion/criterion.h>
|
|
#include "cli.h"
|
|
#include "internal/arg_handler.h"
|
|
|
|
/* Test 1: basic test */
|
|
Test(cli_handle_count, valid_number)
|
|
{
|
|
t_ping_config config = {0};
|
|
const char *arg = "42";
|
|
int ret = cli_handle_count(arg, &config);
|
|
|
|
cr_assert_eq(ret, CLI_SUCCESS);
|
|
cr_assert_eq(config.count, 42);
|
|
}
|
|
|
|
/* Test 2: invalid number */
|
|
Test(cli_handle_count, invalid_number)
|
|
{
|
|
t_ping_config config = {0};
|
|
const char *arg = "-42";
|
|
int ret = cli_handle_count(arg, &config);
|
|
|
|
cr_assert_eq(ret, CLI_ERROR);
|
|
}
|