1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2017-2021 Bartosz Golaszewski <bartekgola@gmail.com>
#include <glib.h>
#include <gpiod.h>
#include <gpiod-test.h>
#include <gpiod-test-common.h>
#include "helpers.h"
#define GPIOD_TEST_GROUP "request-config"
GPIOD_TEST_CASE(default_config)
{
g_autoptr(struct_gpiod_request_config) config = NULL;
config = gpiod_test_create_request_config_or_fail();
g_assert_null(gpiod_request_config_get_consumer(config));
g_assert_cmpuint(gpiod_request_config_get_event_buffer_size(config), ==,
0);
}
GPIOD_TEST_CASE(set_consumer)
{
g_autoptr(struct_gpiod_request_config) config = NULL;
config = gpiod_test_create_request_config_or_fail();
gpiod_request_config_set_consumer(config, "foobar");
g_assert_cmpstr(gpiod_request_config_get_consumer(config), ==,
"foobar");
gpiod_request_config_set_consumer(config, NULL);
g_assert_null(gpiod_request_config_get_consumer(config));
}
GPIOD_TEST_CASE(set_event_buffer_size)
{
g_autoptr(struct_gpiod_request_config) config = NULL;
config = gpiod_test_create_request_config_or_fail();
gpiod_request_config_set_event_buffer_size(config, 128);
g_assert_cmpuint(gpiod_request_config_get_event_buffer_size(config), ==,
128);
}
|