mirror of
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
synced 2026-10-24 00:48:53 +03:00
In order to allow the upcoming GLib and DBus bindings to reuse the test code, let's put all common elements into reusable libtool objects and export the relevant symbols in internal headers. Tested-by: Alexander Sverdlin <alexander.sverdlin@siemens.com> Link: https://lore.kernel.org/r/20240812-dbus-v5-1-ead288509217@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
48 lines
1.2 KiB
C
48 lines
1.2 KiB
C
// 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);
|
|
}
|