==, -1);
gpiod_test_expect_errno(EINVAL);
}
+
+GPIOD_TEST_CASE(set_output_values_bad_args)
+{
+ static const enum gpiod_line_value values[] = {
+ GPIOD_LINE_VALUE_ACTIVE,
+ GPIOD_LINE_VALUE_INACTIVE,
+ GPIOD_LINE_VALUE_ACTIVE,
+ GPIOD_LINE_VALUE_INACTIVE,
+ };
+
+ g_autoptr(struct_gpiod_line_config) config = NULL;
+ gint ret;
+
+ config = gpiod_test_create_line_config_or_fail();
+
+ ret = gpiod_line_config_set_output_values(config, NULL, 4);
+ g_assert_cmpint(ret, ==, -1);
+ gpiod_test_expect_errno(EINVAL);
+
+ ret = gpiod_line_config_set_output_values(config, values, 0);
+ g_assert_cmpint(ret, ==, -1);
+ gpiod_test_expect_errno(EINVAL);
+}
+
+GPIOD_TEST_CASE(set_output_values_too_many_values)
+{
+ static const gsize num_values = 65;
+
+ g_autoptr(struct_gpiod_line_config) config = NULL;
+ g_autofree enum gpiod_line_value *values = NULL;
+ gint ret;
+ gsize i;
+
+ config = gpiod_test_create_line_config_or_fail();
+ values = g_malloc0(sizeof(*values) * num_values);
+
+ for (i = 0; i < num_values; i++)
+ values[i] = GPIOD_LINE_VALUE_ACTIVE;
+
+ ret = gpiod_line_config_set_output_values(config, values, num_values);
+ g_assert_cmpint(ret, ==, -1);
+ gpiod_test_expect_errno(EINVAL);
+}