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