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 1178042 commit 8cf9bf032bea1299a3aa6840a986599bafb45b0a
Showing with 11 additions and 0 deletions.
  1. +11 −0 tests/subsys/usb/device/src/main.c
@@ -232,6 +232,16 @@ static void test_usb_dc_api_invalid(void)
"usb_dc_ep_mps(INVALID_EP)");
}

static void test_usb_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)
{
@@ -241,6 +251,7 @@ void test_main(void)
ztest_unit_test(test_usb_disable),
ztest_unit_test(test_usb_setup),
ztest_unit_test(test_usb_dc_api),
ztest_unit_test(test_usb_dc_api_read),
ztest_unit_test(test_usb_dc_api_invalid),
ztest_unit_test(test_usb_deconfig),
ztest_unit_test(test_usb_disable));

0 comments on commit 8cf9bf0

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