Skip to content
Permalink
Browse files

tests: usb: Add usb_read() for invalid endpoint

Check that reading invalid endpoint does not succeed.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information...
finikorg authored and nashif committed Mar 25, 2019
1 parent b8bab7b commit d0bc6891d843da8b3acecef8cfb079cb893e71c2
Showing with 11 additions and 0 deletions.
  1. +11 −0 tests/subsys/usb/device/src/main.c
@@ -173,6 +173,16 @@ static void test_device_dc_api(void)
"usb_dc_set_address(0x01) (not attached) failed");
}

static void test_device_dc_api_read(void)
{
size_t read;
u8_t byte;

/* Read invalid EP */
zassert_not_equal(usb_read(0x20, &byte, sizeof(byte), &read),
TC_PASS, "usb_read(INVALID)");
}

/*test case main entry*/
void test_main(void)
{
@@ -181,6 +191,7 @@ void test_main(void)
ztest_unit_test(test_device_disable),
ztest_unit_test(test_device_setup),
ztest_unit_test(test_device_dc_api),
ztest_unit_test(test_device_dc_api_read),
ztest_unit_test(test_device_deconfig),
ztest_unit_test(test_device_disable));

0 comments on commit d0bc689

Please sign in to comment.
You can’t perform that action at this time.