15129044dSC.J. Collier/*-
25129044dSC.J. Collier *   BSD LICENSE
35129044dSC.J. Collier *
45129044dSC.J. Collier *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
55129044dSC.J. Collier *   All rights reserved.
65129044dSC.J. Collier *
75129044dSC.J. Collier *   Redistribution and use in source and binary forms, with or without
85129044dSC.J. Collier *   modification, are permitted provided that the following conditions
95129044dSC.J. Collier *   are met:
105129044dSC.J. Collier *
115129044dSC.J. Collier *     * Redistributions of source code must retain the above copyright
125129044dSC.J. Collier *       notice, this list of conditions and the following disclaimer.
135129044dSC.J. Collier *     * Redistributions in binary form must reproduce the above copyright
145129044dSC.J. Collier *       notice, this list of conditions and the following disclaimer in
155129044dSC.J. Collier *       the documentation and/or other materials provided with the
165129044dSC.J. Collier *       distribution.
175129044dSC.J. Collier *     * Neither the name of Intel Corporation nor the names of its
185129044dSC.J. Collier *       contributors may be used to endorse or promote products derived
195129044dSC.J. Collier *       from this software without specific prior written permission.
205129044dSC.J. Collier *
215129044dSC.J. Collier *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
225129044dSC.J. Collier *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
235129044dSC.J. Collier *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
245129044dSC.J. Collier *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
255129044dSC.J. Collier *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
265129044dSC.J. Collier *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
275129044dSC.J. Collier *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
285129044dSC.J. Collier *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
295129044dSC.J. Collier *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
305129044dSC.J. Collier *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
315129044dSC.J. Collier *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
325129044dSC.J. Collier */
335129044dSC.J. Collier
345129044dSC.J. Collier#include <stdio.h>
355129044dSC.J. Collier
365129044dSC.J. Collier#include "test.h"
375129044dSC.J. Collier#include "test_cmdline.h"
385129044dSC.J. Collier
395129044dSC.J. Collierstatic int
405129044dSC.J. Colliertest_cmdline(void)
415129044dSC.J. Collier{
425129044dSC.J. Collier	printf("Testind parsing ethernet addresses...\n");
435129044dSC.J. Collier	if (test_parse_etheraddr_valid() < 0)
445129044dSC.J. Collier		return -1;
455129044dSC.J. Collier	if (test_parse_etheraddr_invalid_data() < 0)
465129044dSC.J. Collier		return -1;
475129044dSC.J. Collier	if (test_parse_etheraddr_invalid_param() < 0)
485129044dSC.J. Collier		return -1;
495129044dSC.J. Collier	printf("Testind parsing port lists...\n");
505129044dSC.J. Collier	if (test_parse_portlist_valid() < 0)
515129044dSC.J. Collier		return -1;
525129044dSC.J. Collier	if (test_parse_portlist_invalid_data() < 0)
535129044dSC.J. Collier		return -1;
545129044dSC.J. Collier	if (test_parse_portlist_invalid_param() < 0)
555129044dSC.J. Collier		return -1;
565129044dSC.J. Collier	printf("Testind parsing numbers...\n");
575129044dSC.J. Collier	if (test_parse_num_valid() < 0)
585129044dSC.J. Collier		return -1;
595129044dSC.J. Collier	if (test_parse_num_invalid_data() < 0)
605129044dSC.J. Collier		return -1;
615129044dSC.J. Collier	if (test_parse_num_invalid_param() < 0)
625129044dSC.J. Collier		return -1;
635129044dSC.J. Collier	printf("Testing parsing IP addresses...\n");
645129044dSC.J. Collier	if (test_parse_ipaddr_valid() < 0)
655129044dSC.J. Collier		return -1;
665129044dSC.J. Collier	if (test_parse_ipaddr_invalid_data() < 0)
675129044dSC.J. Collier		return -1;
685129044dSC.J. Collier	if (test_parse_ipaddr_invalid_param() < 0)
695129044dSC.J. Collier		return -1;
705129044dSC.J. Collier	printf("Testing parsing strings...\n");
715129044dSC.J. Collier	if (test_parse_string_valid() < 0)
725129044dSC.J. Collier		return -1;
735129044dSC.J. Collier	if (test_parse_string_invalid_data() < 0)
745129044dSC.J. Collier		return -1;
755129044dSC.J. Collier	if (test_parse_string_invalid_param() < 0)
765129044dSC.J. Collier		return -1;
775129044dSC.J. Collier	printf("Testing circular buffer...\n");
785129044dSC.J. Collier	if (test_cirbuf_char() < 0)
795129044dSC.J. Collier		return -1;
805129044dSC.J. Collier	if (test_cirbuf_string() < 0)
815129044dSC.J. Collier		return -1;
825129044dSC.J. Collier	if (test_cirbuf_align() < 0)
835129044dSC.J. Collier		return -1;
845129044dSC.J. Collier	if (test_cirbuf_invalid_param() < 0)
855129044dSC.J. Collier		return -1;
865129044dSC.J. Collier	printf("Testing library functions...\n");
875129044dSC.J. Collier	if (test_cmdline_lib() < 0)
885129044dSC.J. Collier		return -1;
895129044dSC.J. Collier	return 0;
905129044dSC.J. Collier}
915129044dSC.J. Collier
929ecc306dSRicardo SalvetiREGISTER_TEST_COMMAND(cmdline_autotest, test_cmdline);
93