lib

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

commit fc4a88ced7bafc311e973d039ff56423e07fa2de
parent ebef6979c0d338b7afa0124ff6029eb227dee005
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Sat, 21 Jan 2017 18:35:25 +0100

Add(More Units Tests for args)

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 @@ -215,6 +215,18 @@ TEST(args_base_1) { return TEST_SUCCESS; } +TEST(args_base_2) { + margs_t opt[] = OPT_DEF(false); + char *av[] = {"./test", "-qw"}; + + 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; @@ -296,4 +308,5 @@ void register_args_tests(void) { reg_test("m_args", args_version_2); reg_test("m_args", args_version_2); reg_test("m_args", args_base_1); + reg_test("m_args", args_base_2); }