android13/external/ltp/lib/newlib_tests/test_macros02.c

43 lines
725 B
C

// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
*/
/*
* Test macros.
*/
#include "tst_test.h"
static int fail_fn(void)
{
errno = EINVAL;
return -1;
}
static int pass_fn(void)
{
return 0;
}
static int inval_ret_fn(void)
{
return 42;
}
static void do_test(void)
{
TST_EXP_FAIL(fail_fn(), EINVAL);
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
TST_EXP_FAIL(fail_fn(), ENOTTY);
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
TST_EXP_FAIL(pass_fn(), ENOTTY);
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
TST_EXP_FAIL(inval_ret_fn(), ENOTTY, "TEST DESCRIPTION");
tst_res(TINFO, "TST_PASS = %i", TST_PASS);
}
static struct tst_test test = {
.test_all = do_test,
};