lib

morphux C utility library
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/lib

commit 5e2560a6b312678bd996c07beb23093903242d84
parent 162eff29de8230691d304af862fa39b23d007845
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 23 Jan 2017 11:25:35 +0100

Add(Tests): New test

Diffstat:
Mtests/test_args.c | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/tests/test_args.c b/tests/test_args.c @@ -227,6 +227,18 @@ TEST(args_base_2) { return TEST_SUCCESS; } +TEST(args_base_3) { + margs_t opt[] = OPT_DEF(false); + char *av[] = {"./test", "-q", "-w"}; + + reset_args(); + TEST_ASSERT((read_opt(sizeof(av) / sizeof(av[0]), av, opt) == 2), "Wrong return"); + TEST_ASSERT(args.opt_q == true, "Argument not read"); + TEST_ASSERT(args.opt_w == true, "Argument not read"); + TEST_ASSERT(args.opt_e != true, "Argument not read"); + return TEST_SUCCESS; +} + void callback_q(const char *s) { args.opt_q = true; @@ -309,4 +321,5 @@ void register_args_tests(void) { reg_test("m_args", args_version_2); reg_test("m_args", args_base_1); reg_test("m_args", args_base_2); + reg_test("m_args", args_base_3); }