From f6ec6b3596c02e24bc188a09484594fe8a4a57b9 Mon Sep 17 00:00:00 2001 From: wu-chengwen Date: Fri, 14 Jan 2022 17:11:30 +0800 Subject: [PATCH] feat:js test for enum in api file Signed-off-by: wu-chengwen --- .../js/default/test/UsbCoreJsunit.test.js | 3 +- .../default/test/UsbDevicePipeJsunit.test.js | 36 ++++++++++++------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/usb/usb_standard/src/main/js/default/test/UsbCoreJsunit.test.js b/usb/usb_standard/src/main/js/default/test/UsbCoreJsunit.test.js index 903f1cab5..0f36416c0 100755 --- a/usb/usb_standard/src/main/js/default/test/UsbCoreJsunit.test.js +++ b/usb/usb_standard/src/main/js/default/test/UsbCoreJsunit.test.js @@ -256,7 +256,7 @@ describe('UsbCoreJsFunctionsTest', function () { console.info('usb SUB_USB_get_raw_descriptor_01 : PASS'); }) - + /** * @tc.number : SUB_USB_get_file_descriptor_01 * @tc.name : getFileDescriptor @@ -322,6 +322,7 @@ describe('UsbCoreJsFunctionsTest', function () { expect(isPipClose).assertEqual(0); console.info('usb SUB_USB_get_file_descriptor_03 : PASS'); }) + /** * @tc.number : SUB_USB_get_file_descriptor_04 * @tc.name : getFileDescriptor diff --git a/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit.test.js b/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit.test.js index 48000b642..201fb865b 100755 --- a/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit.test.js +++ b/usb/usb_standard/src/main/js/default/test/UsbDevicePipeJsunit.test.js @@ -383,7 +383,8 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(6, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), (2 << 8), 0) + var controlParam = getTransferParam(6, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_01 GetDescriptor') }) @@ -401,7 +402,8 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(0, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) + var controlParam = getTransferParam(0, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_02 GetStatus') }) @@ -419,7 +421,8 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(8, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) + var controlParam = getTransferParam(8, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_03 GetConfiguration') }) @@ -437,7 +440,8 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(10, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), 0, 1) + var controlParam = getTransferParam(10, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), 0, 1) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_04 GetInterface') }) @@ -455,7 +459,8 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(1, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) + var controlParam = getTransferParam(1, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_05 ClearFeature') }) @@ -473,7 +478,8 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), (2 << 8), 0) + var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_06 ClearFeature') }) @@ -491,10 +497,12 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_ENDPOINT & 0x1f), (2 << 8), 0) + var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_ENDPOINT & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_07 ClearFeature') }) - /** + + /** * @tc.number : SUB_USB_control_transfer_test_08 * @tc.name : controlTransfer * @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0 @@ -506,13 +514,14 @@ describe('UsbDevicePipeJsFunctionsTest', function () { expect(false).assertTrue(); return } - + var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_VENDOR << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), (2 << 8), 0) + var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + | (usb.USB_REQUEST_TYPE_VENDOR << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_08 ClearFeature') }) - /** + /** * @tc.number : SUB_USB_control_transfer_test_09 * @tc.name : controlTransfer * @tc.desc : 控制传输 ClearFeature: cmd 1 reqType 0 value 0 index 0 @@ -524,9 +533,10 @@ describe('UsbDevicePipeJsFunctionsTest', function () { expect(false).assertTrue(); return } - + var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), 0, 0) + var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'control_transfer_test_09 ClearFeature') }) -- GitLab