tests: use TEST_ASSERT_ERRNO_IS()
authorBartosz Golaszewski <bartekgola@gmail.com>
Fri, 29 Sep 2017 15:22:16 +0000 (17:22 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Fri, 29 Sep 2017 15:22:16 +0000 (17:22 +0200)
Use the new assert macro wherever we're checking the errno value.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
tests/tests-chip.c
tests/tests-line.c
tests/tests-simple-api.c

index c3a1e6f55f2aaf6857c3e33af9cacd01ec8f7bb9..7861d1ec84813db4bb14909c0fb3e999a7431c66 100644 (file)
@@ -32,7 +32,7 @@ static void chip_open_nonexistent(void)
 
        chip = gpiod_chip_open("/dev/nonexistent_gpiochip");
        TEST_ASSERT_NULL(chip);
-       TEST_ASSERT_EQ(errno, ENOENT);
+       TEST_ASSERT_ERRNO_IS(ENOENT);
 }
 TEST_DEFINE(chip_open_nonexistent,
            "gpiod_chip_open() - nonexistent chip",
@@ -44,7 +44,7 @@ static void chip_open_notty(void)
 
        chip = gpiod_chip_open("/dev/null");
        TEST_ASSERT_NULL(chip);
-       TEST_ASSERT_EQ(errno, ENOTTY);
+       TEST_ASSERT_ERRNO_IS(ENOTTY);
 }
 TEST_DEFINE(chip_open_notty,
            "gpiod_chip_open() - notty",
index 57520a6a42f39247f26440cddf83ab81b05b070a..b68578f770e39a644d2bbcadb3f8d3b3fec093a3 100644 (file)
@@ -61,7 +61,7 @@ static void line_request_already_requested(void)
 
        status = gpiod_line_request_input(line, TEST_CONSUMER);
        TEST_ASSERT_NOTEQ(status, 0);
-       TEST_ASSERT_EQ(errno, EBUSY);
+       TEST_ASSERT_ERRNO_IS(EBUSY);
 }
 TEST_DEFINE(line_request_already_requested,
            "gpiod_line_request() - already requested",
@@ -246,7 +246,7 @@ static void line_request_bulk_different_chips(void)
 
        status = gpiod_line_request_bulk(&bulk, &req, NULL);
        TEST_ASSERT_NOTEQ(status, 0);
-       TEST_ASSERT_EQ(errno, EINVAL);
+       TEST_ASSERT_ERRNO_IS(EINVAL);
 }
 TEST_DEFINE(line_request_bulk_different_chips,
            "gpiod_line_request_bulk() - different chips",
index 579cdd484f2d57a674778ec2216233466722da51..dba57314f17060c1899eca5eafc47898f5185c3e 100644 (file)
@@ -99,7 +99,7 @@ static void simple_get_value_multiple_max_lines(void)
                                              GPIOD_REQUEST_MAX_LINES + 1,
                                              false);
        TEST_ASSERT_NOTEQ(ret, 0);
-       TEST_ASSERT_EQ(errno, EINVAL);
+       TEST_ASSERT_ERRNO_IS(EINVAL);
 }
 TEST_DEFINE(simple_get_value_multiple_max_lines,
            "gpiod_simple_get_value_multiple() exceed max lines",
@@ -115,7 +115,7 @@ static void simple_set_value_multiple_max_lines(void)
                                              GPIOD_REQUEST_MAX_LINES + 1,
                                              false, NULL, NULL);
        TEST_ASSERT_NOTEQ(ret, 0);
-       TEST_ASSERT_EQ(errno, EINVAL);
+       TEST_ASSERT_ERRNO_IS(EINVAL);
 }
 TEST_DEFINE(simple_set_value_multiple_max_lines,
            "gpiod_simple_set_value_multiple() exceed max lines",