From 4d4cb8d32db3f947f4e414d692245639b5a2148d Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 23 Feb 2017 15:27:21 +0100 Subject: [PATCH] tests: move exported functions below main() Group all functions that are used exclusively by tests together and below main() for better readability. Signed-off-by: Bartosz Golaszewski --- tests/unit/gpiod-unit.c | 86 ++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/tests/unit/gpiod-unit.c b/tests/unit/gpiod-unit.c index f525055..b6474e4 100644 --- a/tests/unit/gpiod-unit.c +++ b/tests/unit/gpiod-unit.c @@ -124,49 +124,6 @@ static void check_chip_index(unsigned int index) die("invalid chip number requested from test code"); } -const char * gu_chip_path(unsigned int index) -{ - check_chip_index(index); - - return globals.test_ctx.chips[index]->path; -} - -const char * gu_chip_name(unsigned int index) -{ - check_chip_index(index); - - return globals.test_ctx.chips[index]->name; -} - -unsigned int gu_chip_num(unsigned int index) -{ - check_chip_index(index); - - return globals.test_ctx.chips[index]->number; -} - -void _gu_register_test(struct gu_test *test) -{ - struct gu_test *tmp; - - if (!globals.test_list_head) { - globals.test_list_head = globals.test_list_tail = test; - test->_next = NULL; - } else { - tmp = globals.test_list_tail; - globals.test_list_tail = test; - test->_next = NULL; - tmp->_next = test; - } - - globals.num_tests++; -} - -void _gu_set_test_failed(void) -{ - globals.test_ctx.test_failed = true; -} - static bool mockup_loaded(void) { int state; @@ -450,3 +407,46 @@ void gu_release_line(struct gpiod_line **line) if (*line) gpiod_line_release(*line); } + +const char * gu_chip_path(unsigned int index) +{ + check_chip_index(index); + + return globals.test_ctx.chips[index]->path; +} + +const char * gu_chip_name(unsigned int index) +{ + check_chip_index(index); + + return globals.test_ctx.chips[index]->name; +} + +unsigned int gu_chip_num(unsigned int index) +{ + check_chip_index(index); + + return globals.test_ctx.chips[index]->number; +} + +void _gu_register_test(struct gu_test *test) +{ + struct gu_test *tmp; + + if (!globals.test_list_head) { + globals.test_list_head = globals.test_list_tail = test; + test->_next = NULL; + } else { + tmp = globals.test_list_tail; + globals.test_list_tail = test; + test->_next = NULL; + tmp->_next = test; + } + + globals.num_tests++; +} + +void _gu_set_test_failed(void) +{ + globals.test_ctx.test_failed = true; +} -- 2.30.2