From d91d3af73aa505cf7f9bdde5772549a6c418f6b1 Mon Sep 17 00:00:00 2001 From: h00514358 Date: Sat, 8 Oct 2022 16:54:44 +0800 Subject: [PATCH] Add sensor test Signed-off-by: h00514358 --- .../test/unittest/sensor_agent_test.cpp | 54 +- .../test/unittest/ExampleJsunit.test.js | 2787 ++++++++++++----- 2 files changed, 1952 insertions(+), 889 deletions(-) diff --git a/interfaces/native/test/unittest/sensor_agent_test.cpp b/interfaces/native/test/unittest/sensor_agent_test.cpp index d324468e..4dc06b25 100755 --- a/interfaces/native/test/unittest/sensor_agent_test.cpp +++ b/interfaces/native/test/unittest/sensor_agent_test.cpp @@ -132,7 +132,7 @@ HWTEST_F(SensorAgentTest, GetAllSensorsTest_002, TestSize.Level1) SEN_HILOGI("GetAllSensorsTest_002 in"); int32_t count = 0; int32_t ret = GetAllSensors(nullptr, &count); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); ASSERT_EQ(count, 0); } @@ -141,7 +141,7 @@ HWTEST_F(SensorAgentTest, GetAllSensorsTest_003, TestSize.Level1) SEN_HILOGI("GetAllSensorsTest_003 in"); SensorInfo *sensorInfos { nullptr }; int32_t ret = GetAllSensors(&sensorInfos, nullptr); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, ActivateSensorTest_001, TestSize.Level1) @@ -150,15 +150,15 @@ HWTEST_F(SensorAgentTest, ActivateSensorTest_001, TestSize.Level1) SensorUser user; user.callback = nullptr; int32_t ret = SubscribeSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); ret = SetBatch(sensorId, &user, 100000000, 100000000); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); ret = ActivateSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); ret = DeactivateSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); ret = UnsubscribeSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, ActivateSensorTest_002, TestSize.Level1) @@ -167,14 +167,14 @@ HWTEST_F(SensorAgentTest, ActivateSensorTest_002, TestSize.Level1) SensorUser user; user.callback = SensorDataCallbackImpl; int32_t ret = ActivateSensor(invalidValue, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, ActivateSensorTest_003, TestSize.Level1) { SEN_HILOGI("ActivateSensorTest_003 in"); int32_t ret = ActivateSensor(sensorId, nullptr); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, DeactivateSensorTest_001, TestSize.Level1) @@ -183,7 +183,7 @@ HWTEST_F(SensorAgentTest, DeactivateSensorTest_001, TestSize.Level1) SensorUser user; user.callback = nullptr; int32_t ret = DeactivateSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, DeactivateSensorTest_002, TestSize.Level1) @@ -192,14 +192,14 @@ HWTEST_F(SensorAgentTest, DeactivateSensorTest_002, TestSize.Level1) SensorUser user; user.callback = SensorDataCallbackImpl; int32_t ret = DeactivateSensor(invalidValue, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, DeactivateSensorTest_003, TestSize.Level1) { SEN_HILOGI("DeactivateSensorTest_003 in"); int32_t ret = DeactivateSensor(sensorId, nullptr); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, DeactivateSensorTest_004, TestSize.Level1) @@ -208,7 +208,7 @@ HWTEST_F(SensorAgentTest, DeactivateSensorTest_004, TestSize.Level1) SensorUser user; user.callback = nullptr; int32_t ret = DeactivateSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, SetBatchTest_001, TestSize.Level1) @@ -217,9 +217,9 @@ HWTEST_F(SensorAgentTest, SetBatchTest_001, TestSize.Level1) SensorUser user; user.callback = nullptr; int32_t ret = SubscribeSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); ret = SetBatch(sensorId, &user, 100000000, 100000000); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, SetBatchTest_002, TestSize.Level1) @@ -228,14 +228,14 @@ HWTEST_F(SensorAgentTest, SetBatchTest_002, TestSize.Level1) SensorUser user; user.callback = SensorDataCallbackImpl; int32_t ret = SetBatch(invalidValue, &user, 100000000, 100000000); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, SetBatchTest_003, TestSize.Level1) { SEN_HILOGI("SetBatchTest_003 in"); int32_t ret = SetBatch(sensorId, nullptr, invalidValue, invalidValue); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, SubscribeSensorTest_001, TestSize.Level1) @@ -244,7 +244,7 @@ HWTEST_F(SensorAgentTest, SubscribeSensorTest_001, TestSize.Level1) SensorUser user; user.callback = nullptr; int32_t ret = SubscribeSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, SubscribeSensorTest_002, TestSize.Level1) @@ -253,14 +253,14 @@ HWTEST_F(SensorAgentTest, SubscribeSensorTest_002, TestSize.Level1) SensorUser user; user.callback = SensorDataCallbackImpl; int32_t ret = SubscribeSensor(invalidValue, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, SubscribeSensorTest_003, TestSize.Level1) { SEN_HILOGI("SubscribeSensorTest_003 in"); int32_t ret = SubscribeSensor(sensorId, nullptr); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, UnsubscribeSensorTest_001, TestSize.Level1) @@ -269,9 +269,9 @@ HWTEST_F(SensorAgentTest, UnsubscribeSensorTest_001, TestSize.Level1) SensorUser user; user.callback = nullptr; int32_t ret = SubscribeSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); ret = UnsubscribeSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, UnsubscribeSensorTest_002, TestSize.Level1) @@ -280,14 +280,14 @@ HWTEST_F(SensorAgentTest, UnsubscribeSensorTest_002, TestSize.Level1) SensorUser user; user.callback = SensorDataCallbackImpl; int32_t ret = UnsubscribeSensor(invalidValue, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, UnsubscribeSensorTest_003, TestSize.Level1) { SEN_HILOGI("UnsubscribeSensorTest_003 in"); int32_t ret = UnsubscribeSensor(sensorId, nullptr); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, SetModeTest_001, TestSize.Level1) @@ -301,7 +301,7 @@ HWTEST_F(SensorAgentTest, SetModeTest_001, TestSize.Level1) ret = SetMode(sensorId, &user, mode); ASSERT_EQ(ret, OHOS::Sensors::SUCCESS); ret = UnsubscribeSensor(sensorId, &user); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, SetModeTest_002, TestSize.Level1) @@ -310,7 +310,7 @@ HWTEST_F(SensorAgentTest, SetModeTest_002, TestSize.Level1) SensorUser user; user.callback = SensorDataCallbackImpl; int32_t ret = SetMode(invalidValue, &user, invalidValue); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } HWTEST_F(SensorAgentTest, SetModeTest_003, TestSize.Level1) @@ -318,7 +318,7 @@ HWTEST_F(SensorAgentTest, SetModeTest_003, TestSize.Level1) SEN_HILOGI("SetModeTest_003 in"); int32_t mode { 0 }; int32_t ret = SetMode(sensorId, nullptr, mode); - ASSERT_EQ(ret, OHOS::Sensors::ERROR); + ASSERT_NE(ret, OHOS::Sensors::SUCCESS); } /* diff --git a/interfaces/plugin/test/unittest/ExampleJsunit.test.js b/interfaces/plugin/test/unittest/ExampleJsunit.test.js index 2ab9a1c8..b8fd8fb6 100755 --- a/interfaces/plugin/test/unittest/ExampleJsunit.test.js +++ b/interfaces/plugin/test/unittest/ExampleJsunit.test.js @@ -55,31 +55,36 @@ describe("SensorJsTest", function () { console.info('afterEach caled') }) + const PARAMETER_ERROR_CODE = 401 + const SERVICE_EXCEPTION_CODE = 14500101 + const PARAMETER_ERROR_MSG = 'The parameter invalid.' + const SERVICE_EXCEPTION_MSG = 'Service exception.' + /* - * @tc.name:SensorJsTest001 + * @tc.name:SensorJsTest_001 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest001", 0, async function (done) { - console.info('----------------------SensorJsTest001---------------------------'); - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); + it("SensorJsTest_001", 0, async function (done) { + console.info('----------------------SensorJsTest_001---------------------------'); + sensor.on(sensor.SensorId.ACCELEROMETER, callback); setTimeout(()=>{ - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER); + sensor.off(sensor.SensorId.ACCELEROMETER); done(); }, 500); }) /* - * @tc.name:SensorJsTest002 + * @tc.name:SensorJsTest_002 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest002", 0, async function (done) { - console.info('----------------------SensorJsTest002---------------------------'); + it("SensorJsTest_002", 0, async function (done) { + console.info('----------------------SensorJsTest_002---------------------------'); function onSensorCallback(data) { - console.info('SensorJsTest002 on error'); + console.info('SensorJsTest002 callback in'); expect(false).assertTrue(); done(); } @@ -87,58 +92,65 @@ describe("SensorJsTest", function () { sensor.on(-1, onSensorCallback); } catch (error) { console.info(error); - expect(true).assertTrue(); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); done(); } }) /* - * @tc.name:SensorJsTest003 + * @tc.name:SensorJsTest_003 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest003", 0, async function (done) { + it("SensorJsTest_003", 0, async function (done) { console.info('----------------------SensorJsTest003---------------------------'); - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, {'interval': 100000000}); + sensor.on(sensor.SensorId.ACCELEROMETER, callback, {'interval': 100000000}); setTimeout(()=>{ - console.info('----------------------SensorJsTest003 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER); - console.info('----------------------SensorJsTest003 off end---------------------------'); + console.info('----------------------SensorJsTest_003 off in---------------------------'); + sensor.off(sensor.SensorId.ACCELEROMETER); + console.info('----------------------SensorJsTest_003 off end---------------------------'); done(); }, 500); }) /* - * @tc.name:SensorJsTest004 + * @tc.name:SensorJsTest_004 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest004", 0, function (done) { - console.info('----------------------SensorJsTest004---------------------------'); + it("SensorJsTest_004", 0, function (done) { + console.info('----------------------SensorJsTest_004---------------------------'); function onSensorCallback(data) { - console.info('SensorJsTest004 on error'); - expect(false).assertTrue(); + console.info('SensorJsTest004 callback in'); + expect(true).assertTrue(); done(); } try { - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onSensorCallback, {'interval': 100000000}, 5); + sensor.on(sensor.SensorId.ACCELEROMETER, onSensorCallback, {'interval': 100000000}, 5); } catch (error) { console.info(error); - expect(true).assertTrue(); + expect(false).assertTrue(); done(); } + setTimeout(()=>{ + console.info('----------------------SensorJsTest_004 off in---------------------------'); + sensor.off(sensor.SensorId.ACCELEROMETER); + console.info('----------------------SensorJsTest_004 off end---------------------------'); + done(); + }, 500); }) /* - * @tc.name:SensorJsTest005 + * @tc.name:SensorJsTest_005 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest005", 0, async function (done) { - sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); + it("SensorJsTest_005", 0, async function (done) { + sensor.once(sensor.SensorId.ACCELEROMETER, callback); setTimeout(()=>{ expect(true).assertTrue(); done(); @@ -146,14 +158,14 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest006 + * @tc.name:SensorJsTest_006 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest006", 0, async function (done) { + it("SensorJsTest_006", 0, async function (done) { function onceSensorCallback(data) { - console.info('SensorJsTest006 on error'); + console.info('SensorJsTest_006 callback in'); expect(false).assertTrue(); done(); } @@ -161,62 +173,64 @@ describe("SensorJsTest", function () { sensor.once(-1, onceSensorCallback); } catch (error) { console.info(error); - expect(true).assertTrue(); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); done(); } }) /* - * @tc.name:SensorJsTest007 + * @tc.name:SensorJsTest_007 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest007", 0, function (done) { + it("SensorJsTest_007", 0, function (done) { function onceSensorCallback(data) { console.info('SensorJsTest007 on error'); - expect(false).assertTrue(); + expect(true).assertTrue(); done(); } try{ - sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onceSensorCallback, 5); + sensor.once(sensor.SensorId.ACCELEROMETER, onceSensorCallback, 5); } catch (error) { console.info(error); - expect(true).assertTrue(); + expect(false).assertTrue(); done(); } }) /* - * @tc.name:SensorJsTest008 + * @tc.name:SensorJsTest_008 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest008", 0, async function (done) { + it("SensorJsTest_008", 0, async function (done) { try { sensor.off(-1, callback); } catch (error) { console.info(error); - expect(true).assertTrue(); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE) + expect(error.message).assertEqual(PARAMETER_ERROR_MSG) done(); } }) /* - * @tc.name:SensorJsTest009 + * @tc.name:SensorJsTest_009 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest009", 0, async function (done) { + it("SensorJsTest_009", 0, async function (done) { function onSensorCallback(data) { - console.info('SensorJsTest009 on error'); + console.info('SensorJsTest_009 callback in'); expect(false).assertTrue(); done(); } - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onSensorCallback); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onSensorCallback); + sensor.on(sensor.SensorId.ACCELEROMETER, onSensorCallback); + sensor.off(sensor.SensorId.ACCELEROMETER, onSensorCallback); setTimeout(()=>{ expect(true).assertTrue(); done(); @@ -224,12 +238,12 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest010 + * @tc.name:SensorJsTest_010 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest010", 0, async function (done) { + it("SensorJsTest_010", 0, async function (done) { function onSensorCallback(data) { console.info('SensorJsTest010 on error'); expect(false).assertTrue(); @@ -239,120 +253,129 @@ describe("SensorJsTest", function () { sensor.off(1000000, onSensorCallback); } catch (error) { console.info(error); - expect(true).assertTrue(); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE) + expect(error.message).assertEqual(PARAMETER_ERROR_MSG) done(); } }) /* - * @tc.name:SensorJsTest011 + * @tc.name:SensorJsTest_011 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest011", 0, async function (done) { - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (data)=>{ + it("SensorJsTest_011", 0, async function (done) { + sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{ console.info("callback: " + JSON.stringify(data)); expect(typeof(data.x)).assertEqual("number"); }); - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (data)=>{ + sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{ console.info("callback2: " + JSON.stringify(data)); expect(typeof(data.x)).assertEqual("number"); }); setTimeout(()=>{ - console.info('----------------------SensorJsTest011 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER); - console.info('----------------------SensorJsTest011 off end---------------------------'); + console.info('----------------------SensorJsTest_011 off in---------------------------'); + sensor.off(sensor.SensorId.ACCELEROMETER); + console.info('----------------------SensorJsTest_011 off end---------------------------'); done(); }, 1000); }) /* - * @tc.name:SensorJsTest012 + * @tc.name:SensorJsTest_012 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest012", 0, function (done) { + it("SensorJsTest_012", 0, function (done) { try { - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, 5); + sensor.off(sensor.SensorId.ACCELEROMETER, 5); } catch (error) { console.info(error); - expect(true).assertTrue(); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE) + expect(error.message).assertEqual(PARAMETER_ERROR_MSG) done(); } }) /* - * @tc.name:SensorJsTest013 + * @tc.name:SensorJsTest_013 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest013", 0, async function (done) { - console.info('----------------------SensorJsTest014---------------------------'); - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (data)=>{ + it("SensorJsTest_013", 0, async function (done) { + console.info('----------------------SensorJsTest013---------------------------'); + sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{ console.info("callback: " + JSON.stringify(data)); expect(typeof(data.x)).assertEqual("number"); }, {'interval': 100000000}); - sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (data)=>{ + sensor.once(sensor.SensorId.ACCELEROMETER, (data)=>{ console.info("callback2: " + JSON.stringify(data)); expect(typeof(data.x)).assertEqual("number"); }); setTimeout(()=>{ - console.info('----------------------SensorJsTest014 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER); - console.info('----------------------SensorJsTest014 off end---------------------------'); + console.info('----------------------SensorJsTest_013 off in---------------------------'); + sensor.off(sensor.SensorId.ACCELEROMETER); + console.info('----------------------SensorJsTest_013 off end---------------------------'); done(); }, 1000); }) /* - * @tc.name:SensorJsTest014 + * @tc.name:SensorJsTest_014 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest014", 0, async function (done) { + it("SensorJsTest_014", 0, async function (done) { console.info('----------------------SensorJsTest_014---------------------------'); - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (data)=>{ + sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{ console.info("callback: " + JSON.stringify(data)); expect(typeof(data.x)).assertEqual("number"); }, {'interval': 100000000}); - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (data)=>{ + sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{ console.info("callback2: " + JSON.stringify(data)); expect(typeof(data.x)).assertEqual("number"); }, {'interval': 100000000}); setTimeout(()=>{ console.info('----------------------SensorJsTest_014 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER); + sensor.off(sensor.SensorId.ACCELEROMETER); console.info('----------------------SensorJsTest_014 off end---------------------------'); done(); }, 1000); }) /* - * @tc.name:SensorJsTest015 + * @tc.name:SensorJsTest_015 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest015", 0, async function (done) { - console.info('----------------------SensorJsTest015---------------------------'); - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (data)=>{ - console.info("callback: " + JSON.stringify(data)); - expect(typeof(data.x)).assertEqual("number"); - }, {'interval': 100000000}); - sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (data)=>{ - console.info("callback2: " + JSON.stringify(data)); - expect(typeof(data.x)).assertEqual("number"); - }, {'interval': 100000000}); - setTimeout(()=>{ - console.info('----------------------SensorJsTest015 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER); - console.info('----------------------SensorJsTest015 off end---------------------------'); + it("SensorJsTest_015", 0, async function (done) { + console.info('----------------------SensorJsTest_015---------------------------'); + try { + sensor.on(); + } catch (error) { + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); done(); - }, 1000); + } + try { + sensor.once(); + } catch (error) { + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + try { + sensor.off(); + } catch (error) { + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } }) let GEOMAGNETIC_COMPONENT_YEAR_RESULT = [ @@ -380,26 +403,26 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_016 + * @tc.name: Sensor_GetGeomagneticField_001 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2U6 * @tc.author: */ - it('SensorJsTest_016', 0, async function (done) { - console.info("---------------------------SensorJsTest_016----------------------------------"); + it('Sensor_GetGeomagneticField_001', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_001----------------------------------"); let promiseArray = [] for (let i = 0; i < timeMillis.length; i++) { promiseArray.push(new Promise((resolve, reject) => { let j = i - sensor.getGeomagneticField({'latitude':80, 'longitude':0, 'altitude':0}, timeMillis[j], (error, data) => { + sensor.getGeomagneticInfo({'latitude':80, 'longitude':0, 'altitude':0}, timeMillis[j], (error, data) => { if (error) { - console.info('SensorJsTest_016 failed'); + console.info('Sensor_GetGeomagneticField_001 failed'); expect(false).assertTrue(); setTimeout(() =>{ reject() }, 500) } else { - console.info('SensorJsTest_016 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_001 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[j][0]) expect(data.y).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[j][1]) @@ -421,26 +444,26 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_017 + * @tc.name: Sensor_GetGeomagneticField_002 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2U6 * @tc.author: */ - it('SensorJsTest_017', 0, async function (done) { - console.info("---------------------------SensorJsTest_017----------------------------------"); + it('Sensor_GetGeomagneticField_002', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_002----------------------------------"); let promiseArray = [] for (let i = 0; i < GEOMAGNETIC_COORDINATES.length; i++) { promiseArray.push(new Promise((resolve, reject) => { let j = i - sensor.getGeomagneticField({'latitude':GEOMAGNETIC_COORDINATES[j][0], 'longitude':GEOMAGNETIC_COORDINATES[j][1], 'altitude':GEOMAGNETIC_COORDINATES[j][2]}, timeMillis[0], (error, data) => { + sensor.getGeomagneticInfo({'latitude':GEOMAGNETIC_COORDINATES[j][0], 'longitude':GEOMAGNETIC_COORDINATES[j][1], 'altitude':GEOMAGNETIC_COORDINATES[j][2]}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_017 failed'); + console.info('Sensor_GetGeomagneticField_002 failed'); expect(false).assertTrue(); setTimeout(() =>{ reject() }, 500) } else { - console.info('SensorJsTest_017 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_002 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[j][0]) expect(data.y).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[j][1]) @@ -462,21 +485,21 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_018 + * @tc.name: Sensor_GetGeomagneticField_003 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2U6 * @tc.author: */ - it('SensorJsTest_018', 0, async function (done) { - console.info("---------------------------SensorJsTest_018----------------------------------"); + it('Sensor_GetGeomagneticField_003', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_003----------------------------------"); let geomagneticComponent = [27779.234375, -6214.9794921875, -14924.6611328125, -27.667943954467773, -12.610970497131348, 28465.9765625, 32141.2109375] - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':0}, Number.MIN_VALUE, (error, data) => { + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':0}, Number.MIN_VALUE, (error, data) => { if (error) { - console.info('SensorJsTest_018 failed'); + console.info('Sensor_GetGeomagneticField_003 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_018 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_003 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(geomagneticComponent[0]) expect(data.y).assertEqual(geomagneticComponent[1]) @@ -495,20 +518,20 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_019 + * @tc.name: Sensor_GetGeomagneticField_004 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2U6 * @tc.author: */ - it('SensorJsTest_019', 0, async function (done) { - console.info("---------------------------SensorJsTest_019----------------------------------"); + it('Sensor_GetGeomagneticField_004', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_004----------------------------------"); let geomagneticComponent = [1824.141845703125, 116.58167266845703, 56727.7734375, 88.15447235107422, 3.6568238735198975, 1827.8634033203125, 56757.21484375] - sensor.getGeomagneticField({'latitude':Number.MAX_VALUE, 'longitude':0, 'altitude':0}, timeMillis[0], (error, data) => { + sensor.getGeomagneticInfo({'latitude':Number.MAX_VALUE, 'longitude':0, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_019 failed'); + console.info('Sensor_GetGeomagneticField_004 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_019 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_004 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(geomagneticComponent[0]) expect(data.y).assertEqual(geomagneticComponent[1]) @@ -527,20 +550,20 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_020 + * @tc.name: Sensor_GetGeomagneticField_005 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2U6 * @tc.author: */ - it('SensorJsTest_020', 0, async function (done) { - console.info("---------------------------SensorJsTest_020----------------------------------"); + it('Sensor_GetGeomagneticField_005', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_005----------------------------------"); let geomagneticComponent = [1824.141845703125, 116.58167266845703, 56727.7734375, 88.15447235107422, 3.6568238735198975, 1827.8634033203125, 56757.21484375] - sensor.getGeomagneticField({'latitude':Number.NaN, 'longitude':0, 'altitude':0}, timeMillis[0], (error, data) => { + sensor.getGeomagneticInfo({'latitude':Number.NaN, 'longitude':0, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_020 failed'); + console.info('Sensor_GetGeomagneticField_005 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_020 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_005 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(geomagneticComponent[0]) expect(data.y).assertEqual(geomagneticComponent[1]) @@ -559,20 +582,20 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_021 + * @tc.name: Sensor_GetGeomagneticField_006 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2U6 * @tc.author: */ - it('SensorJsTest_021', 0, async function (done) { - console.info("---------------------------SensorJsTest_021----------------------------------"); + it('Sensor_GetGeomagneticField_006', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_006----------------------------------"); let geomagneticComponent = [14425.57421875, -17156.767578125, -52023.21484375, -66.69005584716797, -49.94255447387695, 22415.4375, 56646.859375] - sensor.getGeomagneticField({'latitude':Number.NEGATIVE_INFINITY, 'longitude':0, 'altitude':0}, timeMillis[0], (error, data) => { + sensor.getGeomagneticInfo({'latitude':Number.NEGATIVE_INFINITY, 'longitude':0, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_021 failed'); + console.info('Sensor_GetGeomagneticField_006 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_021 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_006 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(geomagneticComponent[0]) expect(data.y).assertEqual(geomagneticComponent[1]) @@ -591,19 +614,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_022 + * @tc.name: Sensor_GetGeomagneticField_007 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2U6 * @tc.author: */ - it('SensorJsTest_022', 0, async function (done) { - console.info("---------------------------SensorJsTest_022----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':Number.MAX_VALUE, 'altitude':0}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_007', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_007----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.MAX_VALUE, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_022 failed'); + console.info('Sensor_GetGeomagneticField_007 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_022 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_007 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue(); } @@ -616,19 +639,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_023 + * @tc.name: Sensor_GetGeomagneticField_008 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: SR000GH2A3 * @tc.author: */ - it('SensorJsTest_023', 0, async function (done) { - console.info("---------------------------SensorJsTest_023----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_008', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_008----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_023 failed'); + console.info('Sensor_GetGeomagneticField_008 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_023 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_008 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() } @@ -641,19 +664,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_024 + * @tc.name: Sensor_GetGeomagneticField_009 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: SR000GH2A3 * @tc.author: */ - it('SensorJsTest_024', 0, async function (done) { - console.info("---------------------------SensorJsTest_024----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_009', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_009----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_024 failed'); + console.info('Sensor_GetGeomagneticField_009 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_024 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_009 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() } @@ -666,19 +689,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_025 + * @tc.name: Sensor_GetGeomagneticField_010 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: SR000GH2A3 * @tc.author: */ - it('SensorJsTest_025', 0, async function (done) { - console.info("---------------------------SensorJsTest_025----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_010', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_010----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_025 failed'); + console.info('Sensor_GetGeomagneticField_010 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_025 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_010 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() } @@ -691,20 +714,20 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_027 + * @tc.name: Sensor_GetGeomagneticField_011 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: SR000GH2A4 * @tc.author: */ - it('SensorJsTest_027', 0, async function (done) { - console.info("---------------------------SensorJsTest_027----------------------------------"); + it('Sensor_GetGeomagneticField_011', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_011----------------------------------"); let geomagneticComponent = [27536.40234375, -2248.586669921875, -16022.4306640625, -30.110872268676758, -4.66834020614624, 27628.05859375, 31937.875] - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.MIN_VALUE}, timeMillis[0], (error, data) => { + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.MIN_VALUE}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_027 failed'); + console.info('Sensor_GetGeomagneticField_011 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_027 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_011 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(geomagneticComponent[0]) expect(data.y).assertEqual(geomagneticComponent[1]) @@ -723,19 +746,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_028 + * @tc.name: Sensor_GetGeomagneticField_012 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: SR000GH2A4 * @tc.author: */ - it('SensorJsTest_028', 0, async function (done) { - console.info("---------------------------SensorJsTest_028----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_012', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_012----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_028 failed'); + console.info('Sensor_GetGeomagneticField_012 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_028 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_012 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() } @@ -748,19 +771,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_029 + * @tc.name: Sensor_GetGeomagneticField_013 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: SR000GH2A4 * @tc.author: */ - it('SensorJsTest_029', 0, async function (done) { - console.info("---------------------------SensorJsTest_029----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_013', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_013----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_029 failed'); + console.info('Sensor_GetGeomagneticField_013 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_029 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_013 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() } @@ -773,19 +796,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_030 + * @tc.name: Sensor_GetGeomagneticField_014 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_030', 0, async function (done) { - console.info("---------------------------SensorJsTest_030----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_014', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_014----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_030 failed'); + console.info('Sensor_GetGeomagneticField_014 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_030 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_014 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() } @@ -798,19 +821,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_031 + * @tc.name: Sensor_GetGeomagneticField_015 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_031', 0, async function (done) { - console.info("---------------------------SensorJsTest_031----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_015', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_015----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_031 once success'); + console.info('Sensor_GetGeomagneticField_015 once success'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_031 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_015 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() } @@ -823,19 +846,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_032 + * @tc.name: Sensor_GetGeomagneticField_016 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_032', 0, async function (done) { - console.info("---------------------------SensorJsTest_032----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_016', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_016----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_032 failed'); + console.info('Sensor_GetGeomagneticField_016 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_032 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_016 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() } @@ -848,19 +871,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_033 + * @tc.name: Sensor_GetGeomagneticField_017 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_033', 0, async function (done) { - console.info("---------------------------SensorJsTest_033----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_017', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_017----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_033 failed'); + console.info('Sensor_GetGeomagneticField_017 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_033 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_017 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() } @@ -873,19 +896,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_034 + * @tc.name: Sensor_GetGeomagneticField_018 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_034', 0, async function (done) { - console.info("---------------------------SensorJsTest_034----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_018', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_018----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_034 failed'); + console.info('Sensor_GetGeomagneticField_018 failed'); expect(false).assertfalse(); } else { - console.info('SensorJsTest_034 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_018 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() } @@ -898,19 +921,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_035 + * @tc.name: Sensor_GetGeomagneticField_019 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_035', 0, async function (done) { - console.info("---------------------------SensorJsTest_035----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':Number.MAX_VALUE, 'altitude':0}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_019', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_019----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.MAX_VALUE, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_035 failed'); + console.info('Sensor_GetGeomagneticField_019 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_035 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_019 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.levelIntensity) && Number.isNaN(data.totalIntensity)).assertTrue(); } @@ -923,19 +946,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_036 + * @tc.name: Sensor_GetGeomagneticField_020 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_036', 0, async function (done) { - console.info("---------------------------SensorJsTest_036----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_020', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_020----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_036 failed'); + console.info('Sensor_GetGeomagneticField_020 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_036 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_020 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.levelIntensity) && Number.isNaN(data.totalIntensity)).assertTrue() } @@ -948,19 +971,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_037 + * @tc.name: Sensor_GetGeomagneticField_021 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_037', 0, async function (done) { - console.info("---------------------------SensorJsTest_037----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_021', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_021----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_037 failed'); + console.info('Sensor_GetGeomagneticField_021 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_037 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_021 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() } @@ -973,19 +996,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_038 + * @tc.name: Sensor_GetGeomagneticField_022 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_038', 0, async function (done) { - console.info("---------------------------SensorJsTest_038----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_022', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_022----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_038 failed'); + console.info('Sensor_GetGeomagneticField_022 failed'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_038 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_022 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.levelIntensity) && Number.isNaN(data.totalIntensity)).assertTrue() } @@ -998,19 +1021,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_039 + * @tc.name: Sensor_GetGeomagneticField_023 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_039', 0, async function (done) { - console.info("---------------------------SensorJsTest_039----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_023', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_023----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_039 once success'); + console.info('Sensor_GetGeomagneticField_023 once success'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_039 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_023 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.levelIntensity) && Number.isNaN(data.totalIntensity)).assertTrue() } @@ -1023,19 +1046,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_040 + * @tc.name: Sensor_GetGeomagneticField_024 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it('SensorJsTest_040', 0, async function (done) { - console.info("---------------------------SensorJsTest_040----------------------------------"); - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0], (error, data) => { + it('Sensor_GetGeomagneticField_024', 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_024----------------------------------"); + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0], (error, data) => { if (error) { - console.info('SensorJsTest_040 once success'); + console.info('Sensor_GetGeomagneticField_024 once success'); expect(false).assertTrue(); } else { - console.info('SensorJsTest_040 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('Sensor_GetGeomagneticField_024 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.levelIntensity) && Number.isNaN(data.totalIntensity)).assertTrue() } @@ -1048,16 +1071,16 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_041 + * @tc.name: Sensor_GetGeomagneticField_025 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UB * @tc.author: */ - it("SensorJsTest_041", 0, async function (done) { - console.info("---------------------------SensorJsTest_041----------------------------------"); + it("Sensor_GetGeomagneticField_025", 0, async function (done) { + console.info("---------------------------Sensor_GetGeomagneticField_025----------------------------------"); for (var i = 0; i < timeMillis.length; i++) { - await sensor.getGeomagneticField({'latitude':80, 'longitude':0, 'altitude':0}, timeMillis[i]).then((data) => { - console.info('SensorJsTest_041 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + await sensor.getGeomagneticInfo({'latitude':80, 'longitude':0, 'altitude':0}, timeMillis[i]).then((data) => { + console.info('Sensor_GetGeomagneticField_025 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity); expect(data.x).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][0]) expect(data.y).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][1]) @@ -1076,16 +1099,16 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_042 + * @tc.name: Sensor_GetGeomagneticField_026 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UD * @tc.author: */ - it("SensorJsTest_042", 0, async function (done) { - console.info('----------------------SensorJsTest_042---------------------------'); + it("Sensor_GetGeomagneticField_026", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_026---------------------------'); let geomagneticComponent = [27779.234375, -6214.9794921875, -14924.6611328125, -27.667943954467773, -12.610970497131348, 28465.9765625, 32141.2109375] - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':0}, Number.MIN_VALUE).then((data) => { - console.info('SensorJsTest_042 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':0}, Number.MIN_VALUE).then((data) => { + console.info('Sensor_GetGeomagneticField_026 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(geomagneticComponent[0]) expect(data.y).assertEqual(geomagneticComponent[1]) @@ -1103,16 +1126,16 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_043 + * @tc.name: Sensor_GetGeomagneticField_027 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UD * @tc.author: */ - it("SensorJsTest_043", 0, async function (done) { - console.info('----------------------SensorJsTest_043---------------------------'); + it("Sensor_GetGeomagneticField_027", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_027---------------------------'); let geomagneticComponent = [1824.141845703125, 116.58167266845703, 56727.7734375, 88.15447235107422, 3.6568238735198975, 1827.8634033203125, 56757.21484375] - await sensor.getGeomagneticField({'latitude':Number.MAX_VALUE, 'longitude':0, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_043 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + await sensor.getGeomagneticInfo({'latitude':Number.MAX_VALUE, 'longitude':0, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_027 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(geomagneticComponent[0]) expect(data.y).assertEqual(geomagneticComponent[1]) @@ -1130,16 +1153,16 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_044 + * @tc.name: Sensor_GetGeomagneticField_028 * @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.require: AR000GH2UD * @tc.author: */ - it("SensorJsTest_044", 0, async function (done) { - console.info('----------------------SensorJsTest_029---------------------------'); + it("Sensor_GetGeomagneticField_028", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_028---------------------------'); let geomagneticComponent = [1824.141845703125, 116.58167266845703, 56727.7734375, 88.15447235107422, 3.6568238735198975, 1827.8634033203125, 56757.21484375] - await sensor.getGeomagneticField({'latitude':Number.NaN, 'longitude':0, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_029 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + await sensor.getGeomagneticInfo({'latitude':Number.NaN, 'longitude':0, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_028 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(geomagneticComponent[0]) expect(data.y).assertEqual(geomagneticComponent[1]) @@ -1155,16 +1178,16 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_045 + * @tc.name:Sensor_GetGeomagneticField_029 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_045", 0, async function (done) { - console.info('----------------------SensorJsTest_045---------------------------'); + it("Sensor_GetGeomagneticField_029", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_029---------------------------'); let geomagneticComponent = [14425.57421875, -17156.767578125, -52023.21484375, -66.69005584716797, -49.94255447387695, 22415.4375, 56646.859375] - await sensor.getGeomagneticField({'latitude':Number.NEGATIVE_INFINITY, 'longitude':0, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_045 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + await sensor.getGeomagneticInfo({'latitude':Number.NEGATIVE_INFINITY, 'longitude':0, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_029 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(geomagneticComponent[0]) expect(data.y).assertEqual(geomagneticComponent[1]) @@ -1180,16 +1203,16 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_046 + * @tc.name:Sensor_GetGeomagneticField_030 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_046", 0, async function (done) { - console.info('----------------------SensorJsTest_046---------------------------'); + it("Sensor_GetGeomagneticField_030", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_030---------------------------'); let geomagneticComponent = [NaN, NaN, NaN] - await sensor.getGeomagneticField({'latitude':0, 'longitude':Number.MAX_VALUE, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_046 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.MAX_VALUE, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_030 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() }).catch((error) => { @@ -1199,15 +1222,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_047 + * @tc.name:Sensor_GetGeomagneticField_031 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_047", 0, async function (done) { - console.info('----------------------SensorJsTest_047---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_047 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_031", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_031---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_031 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() }).catch((error) => { @@ -1217,15 +1240,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_048 + * @tc.name:Sensor_GetGeomagneticField_032 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_048", 0, async function (done) { - console.info('----------------------SensorJsTest_048---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_048 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_032", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_032---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_032 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() }).catch((error) => { @@ -1235,15 +1258,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_049 + * @tc.name:Sensor_GetGeomagneticField_033 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_049", 0, async function (done) { - console.info('----------------------SensorJsTest_049---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_049 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_033", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_033---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_033 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() }).catch((error) => { @@ -1253,16 +1276,16 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_050 + * @tc.name:Sensor_GetGeomagneticField_034 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_050", 0, async function (done) { - console.info('----------------------SensorJsTest_050---------------------------'); + it("Sensor_GetGeomagneticField_034", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_034---------------------------'); let geomagneticComponent = [27536.40234375, -2248.586669921875, -16022.4306640625, -30.110872268676758, -4.66834020614624, 27628.05859375, 31937.875] - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.MIN_VALUE}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_050 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.MIN_VALUE}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_034 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(geomagneticComponent[0]) expect(data.y).assertEqual(geomagneticComponent[1]) @@ -1278,15 +1301,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_051 + * @tc.name:Sensor_GetGeomagneticField_035 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_051", 0, async function (done) { - console.info('----------------------SensorJsTest_051---------------------------start'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_051 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_035", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_035---------------------------start'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_035 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() }).catch((error) => { @@ -1296,15 +1319,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_052 + * @tc.name:Sensor_GetGeomagneticField_036 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_052", 0, async function (done) { - console.info('----------------------SensorJsTest_052---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_052 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_036", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_036---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_036 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.x) && Number.isNaN(data.y) && Number.isNaN(data.z)).assertTrue() }).catch((error) => { @@ -1314,16 +1337,16 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_053 + * @tc.name:Sensor_GetGeomagneticField_037 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it('SensorJsTest_053', 0, async function (done) { + it('Sensor_GetGeomagneticField_037', 0, async function (done) { for (var i = 0; i < timeMillis.length; i++) { - console.info('----------------------SensorJsTest_053---------------------------'); - await sensor.getGeomagneticField({'latitude':80, 'longitude':0, 'altitude':0}, timeMillis[i]).then((data) => { - console.info('SensorJsTest_053 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + console.info('----------------------Sensor_GetGeomagneticField_037---------------------------'); + await sensor.getGeomagneticInfo({'latitude':80, 'longitude':0, 'altitude':0}, timeMillis[i]).then((data) => { + console.info('Sensor_GetGeomagneticField_037 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity); expect(data.x).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][0]) expect(data.y).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][1]) @@ -1340,15 +1363,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_054 + * @tc.name:Sensor_GetGeomagneticField_038 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_054", 0, async function (done) { - console.info('----------------------SensorJsTest_054---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_054 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_038", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_038---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_038 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() }).catch((error) => { @@ -1358,15 +1381,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_055 + * @tc.name:Sensor_GetGeomagneticField_039 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_055", 0, async function (done) { - console.info('----------------------SensorJsTest_055---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_055 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_039", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_039---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_039 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() }).catch((error) => { @@ -1376,15 +1399,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_056 + * @tc.name:Sensor_GetGeomagneticField_040 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_056", 0, async function (done) { - console.info('----------------------SensorJsTest_056 max ---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_056 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_040", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_040 max ---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_040 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() }).catch((error) => { @@ -1394,15 +1417,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_057 + * @tc.name:Sensor_GetGeomagneticField_041 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_057", 0, async function (done) { - console.info('----------------------SensorJsTest_057---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_057 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_041", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_041---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_041 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() }).catch((error) => { @@ -1412,15 +1435,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_058 + * @tc.name:Sensor_GetGeomagneticField_042 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_058", 0, async function (done) { - console.info('----------------------SensorJsTest_058---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_058 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_042", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_042---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_042 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() }).catch((error) => { @@ -1430,16 +1453,16 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_059 + * @tc.name:Sensor_GetGeomagneticField_043 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it('SensorJsTest_059', 0, async function (done) { - console.info('----------------------SensorJsTest_059---------------------------'); + it('Sensor_GetGeomagneticField_043', 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_043---------------------------'); for (var i = 0; i < GEOMAGNETIC_COORDINATES.length; i++) { - await sensor.getGeomagneticField({'latitude':GEOMAGNETIC_COORDINATES[i][0], 'longitude':GEOMAGNETIC_COORDINATES[i][1], 'altitude':GEOMAGNETIC_COORDINATES[i][2]}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_059 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + await sensor.getGeomagneticInfo({'latitude':GEOMAGNETIC_COORDINATES[i][0], 'longitude':GEOMAGNETIC_COORDINATES[i][1], 'altitude':GEOMAGNETIC_COORDINATES[i][2]}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_043 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(data.x).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[i][0]) expect(data.y).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[i][1]) @@ -1456,15 +1479,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_060 + * @tc.name:Sensor_GetGeomagneticField_044 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_060", 0, async function (done) { - console.info('----------------------SensorJsTest_060---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':Number.MAX_VALUE, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_060 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_044", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_044---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.MAX_VALUE, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_044 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.levelIntensity) && Number.isNaN(data.totalIntensity)).assertTrue(); }).catch((error) => { @@ -1474,15 +1497,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_061 + * @tc.name:Sensor_GetGeomagneticField_045 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_061", 0, async function (done) { - console.info('----------------------SensorJsTest_061---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_061 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_045", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_045---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NaN, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_045 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.levelIntensity) && Number.isNaN(data.totalIntensity)).assertTrue() }).catch((error) => { @@ -1492,15 +1515,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_062 + * @tc.name:Sensor_GetGeomagneticField_046 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_062", 0, async function (done) { - console.info('----------------------SensorJsTest_062---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_062 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_046", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_046---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':Number.NEGATIVE_INFINITY, 'altitude':0}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_046 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.deflectionAngle) && Number.isNaN(data.geomagneticDip)).assertTrue() }).catch((error) => { @@ -1510,15 +1533,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_063 + * @tc.name:Sensor_GetGeomagneticField_047 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_063", 0, async function (done) { - console.info('----------------------SensorJsTest_063---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_063 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_047", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_047---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.MAX_VALUE}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_047 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.levelIntensity) && Number.isNaN(data.totalIntensity)).assertTrue() }).catch((error) => { @@ -1528,15 +1551,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_064 + * @tc.name:Sensor_GetGeomagneticField_048 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_064", 0, async function (done) { - console.info('----------------------SensorJsTest_064---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_064 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_048", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_048---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NaN}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_048 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.levelIntensity) && Number.isNaN(data.totalIntensity)).assertTrue() }).catch((error) => { @@ -1546,15 +1569,15 @@ describe("SensorJsTest", function () { }) /* - * @tc.name:SensorJsTest_065 + * @tc.name:Sensor_GetGeomagneticField_049 * @tc.desc:verify app info is not null * @tc.type: FUNC * @tc.require: Issue Number */ - it("SensorJsTest_065", 0, async function (done) { - console.info('----------------------SensorJsTest_065---------------------------'); - await sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0]).then((data) => { - console.info('SensorJsTest_065 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + it("Sensor_GetGeomagneticField_049", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_049---------------------------'); + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0]).then((data) => { + console.info('Sensor_GetGeomagneticField_049 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) expect(Number.isNaN(data.levelIntensity) && Number.isNaN(data.totalIntensity)).assertTrue() }).catch((error) => { @@ -1563,6 +1586,182 @@ describe("SensorJsTest", function () { done() }) + /* + * @tc.name:Sensor_GetGeomagneticField_050 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetGeomagneticField_050", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_050---------------------------'); + try { + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}).then((data) => { + expect(true).assertfalse() + }).catch((error) => { + expect(true).assertfalse() + }); + done() + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetGeomagneticField_051 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetGeomagneticField_051", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_051---------------------------'); + try { + await sensor.getGeomagneticInfo(-1, timeMillis[0]).then((data) => { + expect(true).assertfalse() + }).catch((error) => { + expect(true).assertfalse() + }); + done() + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetGeomagneticField_052 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetGeomagneticField_052", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_052---------------------------'); + try { + await sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, 'invalid').then((data) => { + expect(true).assertfalse() + }).catch((error) => { + expect(true).assertfalse() + }); + done() + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetGeomagneticField_053 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetGeomagneticField_053", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_053---------------------------'); + try { + await sensor.getGeomagneticInfo({'invalid':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0]).then((data) => { + expect(true).assertfalse() + }).catch((error) => { + expect(true).assertfalse() + }); + done() + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetGeomagneticField_054 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetGeomagneticField_054", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_054---------------------------'); + try { + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, (err, data) => { + expect(false).assertTrue() + setTimeout(() =>{ + done() + }, 500) + }); + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetGeomagneticField_055 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetGeomagneticField_055", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_055---------------------------'); + try { + await sensor.getGeomagneticInfo(-1, timeMillis[0], (err, data) => { + expect(false).assertTrue() + setTimeout(() =>{ + done() + }, 500) + }); + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetGeomagneticField_056 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetGeomagneticField_056", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_056---------------------------'); + try { + sensor.getGeomagneticInfo({'latitude':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, 'invalid', (err, data) => { + expect(false).assertTrue() + setTimeout(() =>{ + done() + }, 500) + }); + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetGeomagneticField_057 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetGeomagneticField_057", 0, async function (done) { + console.info('----------------------Sensor_GetGeomagneticField_057---------------------------'); + try { + sensor.getGeomagneticInfo({'invalid':0, 'longitude':0, 'altitude':Number.NEGATIVE_INFINITY}, timeMillis[0], (err, data) => { + expect(false).assertTrue() + setTimeout(() =>{ + done() + }, 500) + }); + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + var SENSOR_DATA_MATRIX = [ { "rotation": [-0.7980074882507324, 0.5486301183700562, 0.24937734007835388, -0.17277367413043976, @@ -1623,18 +1822,18 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_066 + * @tc.name: Sensor_CreateRotationMatrix_001 * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2RV + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_066', 0, async function (done) { - sensor.createRotationMatrix(gravity[0], geomagnetic[0], (error,data)=>{ + it('Sensor_CreateRotationMatrix_001', 0, async function (done) { + sensor.getRotationMatrix(gravity[0], geomagnetic[0], (error,data)=>{ if (error) { - console.info('SensorJsTest_066 failed'); + console.info('Sensor_CreateRotationMatrix_001 failed'); expect(false).assertTrue(); } else { - console.info("SensorJsTest_066" + JSON.stringify(data)) + console.info("Sensor_CreateRotationMatrix_001" + JSON.stringify(data)) expect(JSON.stringify(data)).assertEqual(JSON.stringify(SENSOR_DATA_MATRIX[0])) } done() @@ -1644,66 +1843,20 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_067 - * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2RV - * @tc.author: - */ - - it('SensorJsTest_067', 0, async function (done) { - sensor.createRotationMatrix(gravity[2],geomagnetic[2],(error,data)=>{ - if (error) { - console.info('SensorJsTest_067 failed'); - expect(false).assertTrue(); - } else { - console.info("SensorJsTest_067" + JSON.stringify(data)) - expect(JSON.stringify(data)).assertEqual(JSON.stringify(SENSOR_DATA_MATRIX[2])) - } - done() - }) - }) - - /** - * test - * - * @tc.name: SensorJsTest_068 + * @tc.name: Sensor_CreateRotationMatrix_002 * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2RV + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_068', 0, async function (done) { - sensor.getDirection(rotationMatrix[0],(error,data)=>{ - if (error) { - console.info('SensorJsTest_068 failed'); - expect(false).assertTrue(); - } else { - for (var i = 1; i < data.length; i++) { - console.info("SensorJsTest_068" + data[i]) - expect(data[i]).assertEqual(GET_DIRECTION[0][i]) - } - } - done() - }) - }) - /** - * test - * - * @tc.name: SensorJsTest_069 - * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2RV - * @tc.author: - */ - it('SensorJsTest_069', 0, async function (done) { - sensor.getDirection(rotationMatrix[1],function(error,data){ + it('Sensor_CreateRotationMatrix_002', 0, async function (done) { + sensor.getRotationMatrix(gravity[2],geomagnetic[2],(error,data)=>{ if (error) { - console.info('SensorJsTest_069 failed'); + console.info('Sensor_CreateRotationMatrix_002 failed'); expect(false).assertTrue(); } else { - for (var i = 1; i < data.length; i++) { - console.info("SensorJsTest_069" + data[i]) - expect(data[i]).assertEqual(GET_DIRECTION[1][i]) - } + console.info("Sensor_CreateRotationMatrix_002" + JSON.stringify(data)) + expect(JSON.stringify(data)).assertEqual(JSON.stringify(SENSOR_DATA_MATRIX[2])) } done() }) @@ -1712,14 +1865,14 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_070 + * @tc.name: Sensor_CreateRotationMatrix_003 * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2RV + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_070', 0, async function (done) { - sensor.createRotationMatrix(gravity[0],geomagnetic[0]).then((data) => { - console.info("SensorJsTest_070" + JSON.stringify(data)) + it('Sensor_CreateRotationMatrix_003', 0, async function (done) { + sensor.getRotationMatrix(gravity[0],geomagnetic[0]).then((data) => { + console.info("Sensor_CreateRotationMatrix_003" + JSON.stringify(data)) expect(JSON.stringify(data)).assertEqual(JSON.stringify(SENSOR_DATA_MATRIX[0])) done() }, (error) =>{ @@ -1731,14 +1884,14 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_071 + * @tc.name: Sensor_CreateRotationMatrix_004 * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2RV + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_071', 0, async function (done) { - sensor.createRotationMatrix(gravity[1],geomagnetic[1]).then((data) => { - console.info("SensorJsTest_071" + JSON.stringify(data)) + it('Sensor_CreateRotationMatrix_004', 0, async function (done) { + sensor.getRotationMatrix(gravity[1],geomagnetic[1]).then((data) => { + console.info("Sensor_CreateRotationMatrix_004" + JSON.stringify(data)) expect(JSON.stringify(data)).assertEqual(JSON.stringify(SENSOR_DATA_MATRIX[1])) done() }, (error) =>{ @@ -1750,14 +1903,14 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_072 + * @tc.name: Sensor_CreateRotationMatrix_005 * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2RV + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_072', 0, async function (done) { - sensor.createRotationMatrix(gravity[2],geomagnetic[2]).then((data) => { - console.info("SensorJsTest_072" + JSON.stringify(data)) + it('Sensor_CreateRotationMatrix_005', 0, async function (done) { + sensor.getRotationMatrix(gravity[2],geomagnetic[2]).then((data) => { + console.info("Sensor_CreateRotationMatrix_005" + JSON.stringify(data)) expect(JSON.stringify(data)).assertEqual(JSON.stringify(SENSOR_DATA_MATRIX[2])) done() }, (error) =>{ @@ -1769,173 +1922,544 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_073 + * @tc.name: Sensor_CreateRotationMatrix_006 * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2RN + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_073', 0, async function (done) { - sensor.getDirection(rotationMatrix[0]).then((data) => { - for (var i = 0; i{ - expect(false).assertTrue(); + it('Sensor_CreateRotationMatrix_006', 0, async function (done) { + try { + sensor.getRotationMatrix() + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) done() - }) + } }) /** * test * - * @tc.name: SensorJsTest_074 + * @tc.name: Sensor_CreateRotationMatrix_007 * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2RN + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_074', 0, async function (done) { - sensor.getDirection(rotationMatrix[1]).then((data) => { - for (var i = 0; i{ - expect(false).assertTrue(); + it('Sensor_CreateRotationMatrix_007', 0, async function (done) { + try { + sensor.getRotationMatrix(-1) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) done() - }) + } }) /** * test * - * @tc.name: SensorJsTest_075 + * @tc.name: Sensor_CreateRotationMatrix_008 * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2RN + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_075', 0, async function (done) { - sensor.getDirection([1,2,3,1,2,3,1,2,3,0]).then((data) => { - for (var i = 0; i{ - expect(true).assertTrue(); - console.info("SensorJsTest_075 success") + it('Sensor_CreateRotationMatrix_008', 0, async function (done) { + try { + sensor.getRotationMatrix(gravity[2], -1) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) done() - }) + } }) - let ANGLECHANGE_9_RESULT = [ - [0.7853981852531433, NaN, -0.32175055146217346], //123123123 - [0.7853981852531433, NaN, -0.7853981852531433], //FLOAT.MAXVALUE - [0.0, -0.0, -0.0], //FLOAT.MINVALUE - [0.7853981852531433, NaN, -0.7853981852531433], //FLOAT.MAXVALUE+1 - ]; - /** * test * - * @tc.name: SensorJsTest_076 - * @tc.desc: - * @tc.require: AR000GH2SL + * @tc.name: Sensor_CreateRotationMatrix_009 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_076', 0, async function (done) { - console.info("SensorJsAPI--->SensorJsTest_076"); - sensor.getAngleModify([1,2,3,1,2,3,1,2,3], [2,2,2,2,2,2,2,2,2], function(error, data) { - if (error) { - console.info('SensorJsTest_076 failed'); - expect(false).assertTrue(); - } else { - for(var i = 0; i < data.length; i++) { - console.info("SensorJsAPI--->SensorJsTest_076 [" + i + "] = " + data[i]); - expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect(Number.isNaN(data[1])).assertTrue() && - expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[0][2]); - } - } + it('Sensor_CreateRotationMatrix_009', 0, async function (done) { + try { + sensor.getRotationMatrix().then((data) => { + expect(true).assertfalse() + done() + }, (error) =>{ + expect(true).assertfalse() + done() + }) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) done() - }) + } }) /** * test * - * @tc.name: SensorJsTest_077 - * @tc.desc: - * @tc.require: AR000GH2SL + * @tc.name: Sensor_CreateRotationMatrix_010 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_077', 0, async function (done) { - console.info("SensorJsAPI--->SensorJsTest_077"); - sensor.getAngleModify([3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38], - [3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38], - function(error, data) { - if (error) { - console.info('SensorJsTest_077 failed'); - expect(false).assertTrue(); - } else { - for(var i = 0; i < data.length; i++) { - console.info("SensorJsAPI--->SensorJsTest_077 [" + i + "] = " + data[i]); - expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[1][0]) && expect(Number.isNaN(data[1])).assertTrue() && - expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[1][2]); - } - } + it('Sensor_CreateRotationMatrix_010', 0, async function (done) { + try { + sensor.getRotationMatrix(-1).then((data) => { + expect(true).assertfalse() + done() + }, (error) =>{ + expect(true).assertfalse() done() }) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } }) /** * test * - * @tc.name: SensorJsTest_078 - * @tc.desc: - * @tc.require: AR000GH2SL + * @tc.name: Sensor_CreateRotationMatrix_011 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_078', 0, async function (done) { - console.info("SensorJsAPI--->SensorJsTest_078"); - sensor.getAngleModify([1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38], - [1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38], - function(error, data) { - if (error) { - console.info('SensorJsTest_078 failed'); - expect(false).assertTrue(); - } else { - for(var i = 0; i < data.length; i++) { - console.info("SensorJsAPI--->SensorJsTest_078 [" + i + "] = " + data[i]); - expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[2][0]) - && expect(data[1]).assertEqual(ANGLECHANGE_9_RESULT[2][1]) - && expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[2][2]); - } - } + it('Sensor_CreateRotationMatrix_011', 0, async function (done) { + try { + sensor.getRotationMatrix(gravity[2], -1).then((data) => { + expect(true).assertfalse() done() - }); + }, (error) =>{ + expect(true).assertfalse() + done() + }) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } }) - /** - * test - * - * @tc.name: SensorJsTest_079 - * @tc.desc: - * @tc.require: AR000GH2SL - * @tc.author: - */ - it('SensorJsTest_079', 0, async function (done) { - console.info("SensorJsAPI--->SensorJsTest_079"); - sensor.getAngleModify([3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1], + let createRotationMatrixResult = [ + [0.6724675297737122,-0.10471208393573761,0.7326819896697998,0.06531608104705811,0.9944750070571899, + 0.08217836916446686,-0.7372390031814575,-0.007406365126371384,0.6755914688110352], + [1,0,0,0,1,0,0,0,1] + ] + /* + * @tc.name: Sensor_CreateRotationMatrix_012 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_CreateRotationMatrix_012', 0, async function (done) { + console.info("Sensor_CreateRotationMatrix_012 start"); + sensor.getRotationMatrix([-0.0245, 0.402, 0.0465], (error, data) =>{ + console.info("Sensor_CreateRotationMatrix_012"); + if (error) { + console.info('Sensor_CreateRotationMatrix_012 failed'); + expect(false).assertTrue(); + } else { + for(var i = 0;i < data.length; i++) { + console.info("Sensor_CreateRotationMatrix_012 [" + i + ") = " + data[i]); + expect(data[i]).assertEqual(createRotationMatrixResult[0][i]) + } + } + done() + }) + console.info(LABEL + "Sensor_CreateRotationMatrix_012 end"); + }) + + /* + * tc.name: Sensor_CreateRotationMatrix_013 + * tc.desc: Verfication results of the incorrect parameters of test interface. + * tc.require: SR000GH2A2 + * @tc.author: + */ + it('Sensor_CreateRotationMatrix_013', 0,async function (done) { + console.info('Sensor_CreateRotationMatrix_013 start') + sensor.getRotationMatrix([-0.0245, 0.402, 0.0465]).then((data) => { + for(var i = 0;i < data.length; i++) { + console.info("Sensor_CreateRotationMatrix_013 [" + i + "] : " + data[i]); + expect(data[i]).assertEqual(createRotationMatrixResult[0][i]) + } + done() + },(error) => { + expect(false).assertTrue(); + console.info('promise failed', error) + done() + }) + console.info( "Sensor_CreateRotationMatrix_013 end") + }) + + /* + * tc.name: Sensor_CreateRotationMatrix_014 + * tc.desc: Verfication results of the incorrect parameters of test interface. + * tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_CreateRotationMatrix_014', 0,async function (done) { + console.info('Sensor_CreateRotationMatrix_014 start') + sensor.getRotationMatrix([0, 0, 0]).then((data) => { + for(var i = 0;i < data.length; i++) { + console.info("Sensor_CreateRotationMatrix_014 [" + i + "] : " + data[i]); + expect(data[i]).assertEqual(createRotationMatrixResult[1][i]) + } + done() + }, (error) => { + expect(false).assertTrue(); + console.info('promise failed', error) + done() + }) + console.info( "Sensor_CreateRotationMatrix_014 end") + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_001 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetDirection_001', 0, async function (done) { + sensor.getOrientation(rotationMatrix[0],(error,data)=>{ + if (error) { + console.info('Sensor_GetDirection_001 failed'); + expect(false).assertTrue(); + } else { + for (var i = 1; i < data.length; i++) { + console.info("Sensor_GetDirection_001" + data[i]) + expect(data[i]).assertEqual(GET_DIRECTION[0][i]) + } + } + done() + }) + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_002 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetDirection_002', 0, async function (done) { + sensor.getOrientation(rotationMatrix[1],function(error,data){ + if (error) { + console.info('Sensor_GetDirection_002 failed'); + expect(false).assertTrue(); + } else { + for (var i = 1; i < data.length; i++) { + console.info("Sensor_GetDirection_002" + data[i]) + expect(data[i]).assertEqual(GET_DIRECTION[1][i]) + } + } + done() + }) + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_003 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: AR000GH2RN + * @tc.author: + */ + it('Sensor_GetDirection_003', 0, async function (done) { + sensor.getOrientation(rotationMatrix[0]).then((data) => { + for (var i = 0; i{ + expect(false).assertTrue(); + done() + }) + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_004 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: AR000GH2RN + * @tc.author: + */ + it('Sensor_GetDirection_004', 0, async function (done) { + sensor.getOrientation(rotationMatrix[1]).then((data) => { + for (var i = 0; i{ + expect(false).assertTrue(); + done() + }) + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_005 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: AR000GH2RN + * @tc.author: + */ + it('Sensor_GetDirection_005', 0, async function (done) { + sensor.getOrientation([1,2,3,1,2,3,1,2,3,0]).then((data) => { + for (var i = 0; i{ + expect(true).assertTrue(); + console.info("Sensor_GetDirection_005 success") + done() + }) + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_006 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetDirection_006', 0, async function (done) { + try { + sensor.getRotationMatrix() + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_007 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetDirection_007', 0, async function (done) { + try { + sensor.getRotationMatrix(-1) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_008 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetDirection_008', 0, async function (done) { + try { + sensor.getRotationMatrix(rotationMatrix[1], -1) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_009 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetDirection_009', 0, async function (done) { + try { + sensor.getRotationMatrix().then((data) => { + expect(true).assertfalse() + done() + }, (error) =>{ + expect(true).assertfalse() + done() + }) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_010 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetDirection_010', 0, async function (done) { + try { + sensor.getRotationMatrix(-1).then((data) => { + expect(true).assertfalse() + done() + }, (error) =>{ + expect(true).assertfalse() + done() + }) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /** + * test + * + * @tc.name: Sensor_GetDirection_011 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetDirection_011', 0, async function (done) { + try { + sensor.getRotationMatrix(rotationMatrix[1], -1).then((data) => { + expect(true).assertfalse() + done() + }, (error) =>{ + expect(true).assertfalse() + done() + }) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + let ANGLECHANGE_9_RESULT = [ + [0.7853981852531433, NaN, -0.32175055146217346], //123123123 + [0.7853981852531433, NaN, -0.7853981852531433], //FLOAT.MAXVALUE + [0.0, -0.0, -0.0], //FLOAT.MINVALUE + [0.7853981852531433, NaN, -0.7853981852531433], //FLOAT.MAXVALUE+1 + ]; + + /** + * test + * + * @tc.name: Sensor_GetAngleModify_001 + * @tc.desc: + * @tc.require: AR000GH2SL + * @tc.author: + */ + it('Sensor_GetAngleModify_001', 0, async function (done) { + console.info("SensorJsAPI--->Sensor_GetAngleModify_001"); + sensor.getAngleVariation([1,2,3,1,2,3,1,2,3], [2,2,2,2,2,2,2,2,2], function(error, data) { + if (error) { + console.info('Sensor_GetAngleModify_001 failed'); + expect(false).assertTrue(); + } else { + for(var i = 0; i < data.length; i++) { + console.info("Sensor_GetAngleModify_001 [" + i + "] = " + data[i]); + expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect(Number.isNaN(data[1])).assertTrue() && + expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[0][2]); + } + } + done() + }) + }) + + /** + * test + * + * @tc.name: Sensor_GetAngleModify_002 + * @tc.desc: + * @tc.require: AR000GH2SL + * @tc.author: + */ + it('Sensor_GetAngleModify_002', 0, async function (done) { + console.info("Sensor_GetAngleModify_002"); + sensor.getAngleVariation([3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38], + [3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38], + function(error, data) { + if (error) { + console.info('Sensor_GetAngleModify_002 failed'); + expect(false).assertTrue(); + } else { + for(var i = 0; i < data.length; i++) { + console.info("Sensor_GetAngleModify_002 [" + i + "] = " + data[i]); + expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[1][0]) && expect(Number.isNaN(data[1])).assertTrue() && + expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[1][2]); + } + } + done() + }) + }) + + /** + * test + * + * @tc.name: Sensor_GetAngleModify_003 + * @tc.desc: + * @tc.require: AR000GH2SL + * @tc.author: + */ + it('Sensor_GetAngleModify_003', 0, async function (done) { + console.info("Sensor_GetAngleModify_003 in"); + sensor.getAngleVariation([1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38], + [1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38], + function(error, data) { + if (error) { + console.info('Sensor_GetAngleModify_003 failed'); + expect(false).assertTrue(); + } else { + for(var i = 0; i < data.length; i++) { + console.info("Sensor_GetAngleModify_003 [" + i + "] = " + data[i]); + expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[2][0]) + && expect(data[1]).assertEqual(ANGLECHANGE_9_RESULT[2][1]) + && expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[2][2]); + } + } + done() + }); + }) + + /** + * test + * + * @tc.name: Sensor_GetAngleModify_004 + * @tc.desc: + * @tc.require: AR000GH2SL + * @tc.author: + */ + it('Sensor_GetAngleModify_004', 0, async function (done) { + console.info("Sensor_GetAngleModify_004"); + sensor.getAngleVariation([3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1], [3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1, 3.40282e+38+1], function(error, data) { if (error) { - console.info('SensorJsTest_079 failed'); + console.info('Sensor_GetAngleModify_004 failed'); expect(false).assertTrue(); } else { for(var i = 0; i < data.length; i++) { - console.info("SensorJsAPI--->SensorJsTest_079 [" + i + "] = " + data[i]); + console.info("Sensor_GetAngleModify_004 [" + i + "] = " + data[i]); expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[3][0]) && expect(Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[3][2]); } } @@ -1946,22 +2470,22 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_080 + * @tc.name: Sensor_GetAngleModify_005 * @tc.desc: * @tc.require: AR000GH2SL * @tc.author: */ - it('SensorJsTest_080', 0, async function (done) { - console.info("SensorJsAPI--->SensorJsTest_080"); - sensor.getAngleModify([0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0], + it('Sensor_GetAngleModify_005', 0, async function (done) { + console.info("Sensor_GetAngleModify_005 in"); + sensor.getAngleVariation([0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0], [0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0], function(error, data) { if (error) { - console.info('SensorJsTest_080 failed'); + console.info('Sensor_GetAngleModify_005 failed'); expect(false).assertTrue(); } else { for(var i = 0; i < data.length; i++) { - console.info("SensorJsAPI--->SensorJsTest_080 [" + i + "] = " + data[i]); + console.info("Sensor_GetAngleModify_005 [" + i + "] = " + data[i]); expect(Number.isNaN(data[0]) && Number.isNaN(data[1]) && Number.isNaN(data[2])).assertTrue(); } } @@ -1972,20 +2496,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_081 + * @tc.name: Sensor_GetAngleModify_006 * @tc.desc: * @tc.require: AR000GH2SL * @tc.author: */ - it('SensorJsTest_081', 0, async function (done) { - console.info("SensorJsAPI--->SensorJsTest_081"); - sensor.getAngleModify([1,2,3,1,2,3,1,2,3], [2,2,2,2,2,2,2,2,2]).then((data) => { - console.info("SensorJsAPI--->SensorJsTest_081"); - for(var i = 0; i < data.length; i++) { - console.info("SensorJsAPI--->SensorJsTest_081 [" + i + "] = " + data[i]); - expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect(Number.isNaN(data[1])).assertTrue() && + it('Sensor_GetAngleModify_006', 0, async function (done) { + console.info("Sensor_GetAngleModify_006 in"); + sensor.getAngleVariation([1,2,3,1,2,3,1,2,3], [2,2,2,2,2,2,2,2,2]).then((data) => { + for(var i = 0; i < data.length; i++) { + console.info("Sensor_GetAngleModify_006 [" + i + "] = " + data[i]); + expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect(Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[0][2]); - } + } done(); }, (error) =>{ expect(false).assertTrue(); @@ -1996,20 +2519,19 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_082 + * @tc.name: Sensor_GetAngleModify_007 * @tc.desc: * @tc.require: AR000GH2SL * @tc.author: */ - it('SensorJsTest_082', 0, async function (done) { - console.info("SensorJsAPI--->SensorJsTest_082"); - sensor.getAngleModify([3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38], + it('Sensor_GetAngleModify_007', 0, async function (done) { + console.info("Sensor_GetAngleModify_007 in"); + sensor.getAngleVariation([3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38], [3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38]).then((data) => { - console.info("SensorJsAPI--->SensorJsTest_082"); - for(var i = 0; i < data.length; i++) { - console.info("SensorJsAPI--->SensorJsTest_082 [" + i + "] = " + data[i]); - expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[1][0]) && expect(Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[1][2]); - } + for(var i = 0; i < data.length; i++) { + console.info("Sensor_GetAngleModify_007 [" + i + "] = " + data[i]); + expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[1][0]) && expect(Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[1][2]); + } done() }, (error) =>{ expect(false).assertTrue(); @@ -2020,18 +2542,17 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_083 + * @tc.name: Sensor_GetAngleModify_008 * @tc.desc: * @tc.require: AR000GH2SL * @tc.author: */ - it('SensorJsTest_083', 0, async function (done) { - console.info("SensorJsAPI--->SensorJsTest_083"); - sensor.getAngleModify([1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38], + it('Sensor_GetAngleModify_008', 0, async function (done) { + console.info("Sensor_GetAngleModify_008 in"); + sensor.getAngleVariation([1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38], [1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38]).then((data) => { - console.info("SensorJsAPI--->SensorJsTest_083"); for(var i = 0; i < data.length; i++) { - console.info("SensorJsAPI--->SensorJsTest_083 [" + i + "] = " + data[i]); + console.info("Sensor_GetAngleModify_008 [" + i + "] = " + data[i]); expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[2][0]) && expect(data[1]).assertEqual(ANGLECHANGE_9_RESULT[2][1]) && expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[2][2]); @@ -2046,19 +2567,18 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_084 + * @tc.name: Sensor_GetAngleModify_009 * @tc.desc: * @tc.require: AR000GH2SL * @tc.author: */ - it('SensorJsTest_084', 0, async function (done) { - console.info("SensorJsAPI--->SensorJsTest_074"); - sensor.getAngleModify([3.40282e+38 + 1,3.40282e+38 + 1,3.40282e+38 + 1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1], + it('Sensor_GetAngleModify_009', 0, async function (done) { + console.info("Sensor_GetAngleModify_009 in"); + sensor.getAngleVariation([3.40282e+38 + 1,3.40282e+38 + 1,3.40282e+38 + 1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1], [3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1,3.40282e+38+1]) .then((data) => { - console.info("SensorJsAPI--->SensorJsTest_084"); for(var i = 0; i < data.length; i++) { - console.info("SensorJsAPI--->SensorJsTest_084 [" + i + "] = " + data[i]); + console.info("Sensor_GetAngleModify_009 [" + i + "] = " + data[i]); expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[3][0]) && expect(Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[3][2]); } done() @@ -2071,18 +2591,17 @@ describe("SensorJsTest", function () { /** * test * - * @tc.name: SensorJsTest_085 + * @tc.name: Sensor_GetAngleModify_010 * @tc.desc: * @tc.require: AR000GH2SL * @tc.author: */ - it('SensorJsTest_085', 0, async function (done) { - console.info("SensorJsAPI--->SensorJsTest_085"); - sensor.getAngleModify([0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0], + it('Sensor_GetAngleModify_010', 0, async function (done) { + console.info("Sensor_GetAngleModify_010 in"); + sensor.getAngleVariation([0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0], [0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0]).then((data) => { - console.info("SensorJsAPI--->SensorJsTest_085"); for(var i = 0; i < data.length; i++) { - console.info("SensorJsAPI--->SensorJsTest_085 [" + i + "] = " + data[i]); + console.info("Sensor_GetAngleModify_010 [" + i + "] = " + data[i]); expect(Number.isNaN(data[0]) && Number.isNaN(data[1]) && Number.isNaN(data[2])).assertTrue(); } done() @@ -2092,6 +2611,138 @@ describe("SensorJsTest", function () { }) }) + /* + * @tc.name:Sensor_GetAngleModify_011 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetAngleModify_011", 0, async function (done) { + console.info('----------------------Sensor_GetAngleModify_011---------------------------'); + try { + await sensor.getAngleVariation([1,2,3,1,2,3,1,2,3]).then((data) => { + expect(true).assertfalse() + }).catch((error) => { + expect(true).assertfalse() + }); + done() + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetAngleModify_012 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetAngleModify_012", 0, async function (done) { + console.info('----------------------Sensor_GetAngleModify_012---------------------------'); + try { + await sensor.getAngleVariation(-1, [2,2,2,2,2,2,2,2,2]).then((data) => { + expect(true).assertfalse() + }).catch((error) => { + expect(true).assertfalse() + }); + done() + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetAngleModify_013 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetAngleModify_013", 0, async function (done) { + console.info('----------------------Sensor_GetAngleModify_013---------------------------'); + try { + await sensor.getAngleVariation([1,2,3,1,2,3,1,2,3], 'invalid').then((data) => { + expect(true).assertfalse() + }).catch((error) => { + expect(true).assertfalse() + }); + done() + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetAngleModify_014 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetAngleModify_014", 0, async function (done) { + console.info('----------------------Sensor_GetAngleModify_014---------------------------'); + try { + sensor.getAngleVariation([1,2,3,1,2,3,1,2,3], (err, data) => { + expect(false).assertTrue() + setTimeout(() =>{ + done() + }, 500) + }); + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetAngleModify_015 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetAngleModify_015", 0, async function (done) { + console.info('----------------------Sensor_GetAngleModify_015---------------------------'); + try { + await sensor.getAngleVariation(-1, [2,2,2,2,2,2,2,2,2], (err, data) => { + expect(false).assertTrue() + setTimeout(() =>{ + done() + }, 500) + }); + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * @tc.name:Sensor_GetAngleModify_016 + * @tc.desc:verify app info is not null + * @tc.type: FUNC + * @tc.require: I5SWJI + */ + it("Sensor_GetAngleModify_016", 0, async function (done) { + console.info('----------------------Sensor_GetAngleModify_016---------------------------'); + try { + sensor.getAngleVariation([1,2,3,1,2,3,1,2,3], 'invalid', (err, data) => { + expect(false).assertTrue() + setTimeout(() =>{ + done() + }, 500) + }); + } catch(err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + var result = [ [0.7441122531890869, 0.5199999809265137, -0.335999995470047, -0.25099998712539673], [0, 3.402820018375656e+38, 3.402820018375656e+38, 3.402820018375656e+38], @@ -2101,126 +2752,126 @@ describe("SensorJsTest", function () { ] /* - * @tc.name: SensorJsTest_086 + * @tc.name: Sensor_CreateQuaterniont_001 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2RP * @tc.author: */ - it('SensorJsTest_086', 0,async function (done) { - console.info('SensorJsTest_086 start') - sensor.createQuaternion([0.52, -0.336, -0.251], (error, data) =>{ - console.info('SensorJsTest_086' + 'lengh:' + data.length); - if (error) { - console.info('SensorJsTest_086 failed'); + it('Sensor_CreateQuaterniont_001', 0,async function (done) { + console.info('Sensor_CreateQuaterniont_001 start') + sensor.getQuaternion([0.52, -0.336, -0.251], (error, data) =>{ + console.info('Sensor_CreateQuaterniont_001' + 'lengh:' + data.length); + if (error) { + console.info('Sensor_CreateQuaterniont_001 failed'); expect(false).assertTrue(); } else { - for (var i = 0; i < data.length; i++) { - console.info("data[" + i + "]: " + data[i]) - expect(data[i]).assertEqual(result[0][i]) - } + for (var i = 0; i < data.length; i++) { + console.info("data[" + i + "]: " + data[i]) + expect(data[i]).assertEqual(result[0][i]) + } } - done() + done() }) }) /* - * @tc.name: SensorJsTest_087 + * @tc.name: Sensor_CreateQuaterniont_002 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2RP * @tc.author: */ - it('SensorJsTest_087', 0,async function (done) { - console.info('SensorJsTest_087 start') - sensor.createQuaternion([3.40282e+38, 3.40282e+38, 3.40282e+38], (error, data) =>{ - if (error) { - console.info('SensorJsTest_087 failed'); + it('Sensor_CreateQuaterniont_002', 0,async function (done) { + console.info('Sensor_CreateQuaterniont_002 start') + sensor.getQuaternion([3.40282e+38, 3.40282e+38, 3.40282e+38], (error, data) =>{ + if (error) { + console.info('Sensor_CreateQuaterniont_002 failed'); expect(false).assertTrue(); } else { - for (var i = 0; i < data.length; i++) { - console.info("data[" + i + "]: " + data[i]) - expect(data[i]).assertEqual(result[1][i]) - } + for (var i = 0; i < data.length; i++) { + console.info("data[" + i + "]: " + data[i]) + expect(data[i]).assertEqual(result[1][i]) + } } done() }) }) /* - * @tc.name: SensorJsTest_088 + * @tc.name: Sensor_CreateQuaterniont_003 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2RP * @tc.author: */ - it('SensorJsTest_088', 0,async function (done) { - console.info('SensorJsTest_088 start') - sensor.createQuaternion([0, 0, 0], (error, data) =>{ - if (error) { - console.info('SensorJsTest_088 failed'); + it('Sensor_CreateQuaterniont_003', 0,async function (done) { + console.info('Sensor_CreateQuaterniont_003 start') + sensor.getQuaternion([0, 0, 0], (error, data) =>{ + if (error) { + console.info('Sensor_CreateQuaterniont_003 failed'); expect(false).assertTrue(); } else { - for (var i = 0; i < data.length; i++) { - console.info("data[" + i + "]: " + data[i]) - expect(data[i]).assertEqual(result[2][i]) - } + for (var i = 0; i < data.length; i++) { + console.info("data[" + i + "]: " + data[i]) + expect(data[i]).assertEqual(result[2][i]) + } } done() }) - console.info("SensorJsTest_088 end") + console.info("Sensor_CreateQuaterniont_003 end") }) /* - * @tc.name: SensorJsTest_089 + * @tc.name: Sensor_CreateQuaterniont_004 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2RP * @tc.author: */ - it('SensorJsTest_089', 0,async function (done) { - console.info('SensorJsTest_089 start') - sensor.createQuaternion([-0.325, -0.562, -0.25], (error, data) =>{ - if (error) { - console.info('SensorJsTest_089 failed'); + it('Sensor_CreateQuaterniont_004', 0,async function (done) { + console.info('Sensor_CreateQuaterniont_004 start') + sensor.getQuaternion([-0.325, -0.562, -0.25], (error, data) =>{ + if (error) { + console.info('Sensor_CreateQuaterniont_004 failed'); expect(false).assertTrue(); } else { - for (var i = 0; i < data.length; i++) { - console.info("data[" + i + "]: " + data[i]) - expect(data[i]).assertEqual(result[3][i]) - } + for (var i = 0; i < data.length; i++) { + console.info("data[" + i + "]: " + data[i]) + expect(data[i]).assertEqual(result[3][i]) + } } done() }) - console.info("SensorJsTest_089 end") + console.info("Sensor_CreateQuaterniont_004 end") }) /* - * @tc.name: SensorJsTest_090 + * @tc.name: Sensor_CreateQuaterniont_005 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2RP * @tc.author: */ - it('SensorJsTest_090', 0,async function (done) { - console.info('SensorJsTest_090 start') - sensor.createQuaternion([0.25, 0.14], (error, data) =>{ - if (error) { - console.info('SensorJsTest_090 failed'); + it('Sensor_CreateQuaterniont_005', 0,async function (done) { + console.info('Sensor_CreateQuaterniont_005 start') + sensor.getQuaternion([0.25, 0.14], (error, data) =>{ + if (error) { + console.info('Sensor_CreateQuaterniont_005 failed'); expect(true).assertTrue(); } else { expect(false).assertTrue(); } done() }) - console.info("SensorJsTest_090 end") + console.info("Sensor_CreateQuaterniont_005 end") }) /* - * @tc.name: SensorJsTest_091 + * @tc.name: Sensor_CreateQuaterniont_006 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2RP * @tc.author: */ - it('SensorJsTest_091', 0,async function (done) { - console.info('SensorJsTest_091 start') - sensor.createQuaternion([0.52, -0.336, -0.251]).then((data) => { - console.info('SensorJsTest_091'); + it('Sensor_CreateQuaterniont_006', 0,async function (done) { + console.info('Sensor_CreateQuaterniont_006 start') + sensor.getQuaternion([0.52, -0.336, -0.251]).then((data) => { + console.info('Sensor_CreateQuaterniont_006'); for (var i = 0; i < data.length; i++) { console.info("data[" + i + "]: " + data[i]); expect(data[i]).assertEqual(result[0][i]) @@ -2231,19 +2882,19 @@ describe("SensorJsTest", function () { console.info('promise failed') done() }) - console.info("SensorJsTest_091 end") + console.info("Sensor_CreateQuaterniont_006 end") }) /* - * @tc.name: SensorJsTest_092 + * @tc.name: Sensor_CreateQuaterniont_007 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2RP * @tc.author: */ - it('SensorJsTest_092', 0,async function (done) { - console.info('SensorJsTest_092 start') - sensor.createQuaternion([0, 0]).then((data) => { - console.info('SensorJsTest_092'); + it('Sensor_CreateQuaterniont_007', 0,async function (done) { + console.info('Sensor_CreateQuaterniont_007 start') + sensor.getQuaternion([0, 0]).then((data) => { + console.info('Sensor_CreateQuaterniont_007'); expect(false).assertTrue(); done() }, (error) => { @@ -2251,19 +2902,19 @@ describe("SensorJsTest", function () { console.info('promise failed') done() }) - console.info("SensorJsTest_092 end") + console.info("Sensor_CreateQuaterniont_007 end") }) /* - * @tc.name: SensorJsTest_093 + * @tc.name: Sensor_CreateQuaterniont_008 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2RP * @tc.author: */ - it('SensorJsTest_093', 0,async function (done) { - console.info('SensorJsTest_093 start') - sensor.createQuaternion([0, 0, 0]).then((data) => { - console.info('SensorJsTest_093'); + it('Sensor_CreateQuaterniont_008', 0,async function (done) { + console.info('Sensor_CreateQuaterniont_008 start') + sensor.getQuaternion([0, 0, 0]).then((data) => { + console.info('Sensor_CreateQuaterniont_008'); for (var i = 0; i < data.length; i++) { console.info("data[" + i + "]: " + data[i]); expect(data[i]).assertEqual(result[2][i]) @@ -2274,19 +2925,19 @@ describe("SensorJsTest", function () { console.info('promise failed') done() }) - console.info("SensorJsTest_093 end") + console.info("Sensor_CreateQuaterniont_008 end") }) /* - * @tc.name: SensorJsTest_094 + * @tc.name: Sensor_CreateQuaterniont_009 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2RP * @tc.author: */ - it('SensorJsTest_094', 0,async function (done) { - console.info('SensorJsTest_094 start') - sensor.createQuaternion([-0.325, -0.562, -0.25]).then((data) => { - console.info('SensorJsTest_094'); + it('Sensor_CreateQuaterniont_009', 0,async function (done) { + console.info('Sensor_CreateQuaterniont_009 start') + sensor.getQuaternion([-0.325, -0.562, -0.25]).then((data) => { + console.info('Sensor_CreateQuaterniont_009'); for (var i = 0; i < data.length; i++) { console.info("data[" + i + "]: " + data[i]); expect(data[i]).assertEqual(result[3][i]) @@ -2300,220 +2951,473 @@ describe("SensorJsTest", function () { }) /* - * @tc.name: SensorJsTest_095 + * @tc.name: Sensor_CreateQuaterniont_010 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: AR000GH2RP + * @tc.author: + */ + it('Sensor_CreateQuaterniont_010', 0,async function (done) { + console.info('Sensor_CreateQuaterniont_010 start') + sensor.getQuaternion([0.25, 0.14]).then((data) => { + console.info('Sensor_CreateQuaterniont_010'); + expect(false).assertTrue(); + done() + },(error) => { + expect(true).assertTrue(); + console.info('promise failed') + done() + }) + }) + + /* + * test + * + * @tc.name: Sensor_CreateQuaterniont_011 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_CreateQuaterniont_011', 0, async function (done) { + try { + sensor.createQuaternion() + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * test + * + * @tc.name: Sensor_CreateQuaterniont_012 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_CreateQuaterniont_012', 0, async function (done) { + try { + sensor.createQuaternion(-1) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * test + * + * @tc.name: Sensor_CreateQuaterniont_013 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_CreateQuaterniont_013', 0, async function (done) { + try { + sensor.createQuaternion([0.52, -0.336, -0.251], -1) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * test + * + * @tc.name: Sensor_CreateQuaterniont_014 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_CreateQuaterniont_014', 0, async function (done) { + try { + sensor.createQuaternion().then((data) => { + expect(true).assertfalse() + done() + }, (error) =>{ + expect(true).assertfalse() + done() + }) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * test + * + * @tc.name: Sensor_CreateQuaterniont_015 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_CreateQuaterniont_015', 0, async function (done) { + try { + sensor.createQuaternion(-1).then((data) => { + expect(true).assertfalse() + done() + }, (error) =>{ + expect(true).assertfalse() + done() + }) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + /* + * test + * + * @tc.name: Sensor_CreateQuaterniont_016 + * @tc.desc: Verification results of the incorrect parameters of the test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_CreateQuaterniont_016', 0, async function (done) { + try { + sensor.createQuaternion([0.52, -0.336, -0.251], -1).then((data) => { + expect(true).assertfalse() + done() + }, (error) =>{ + expect(true).assertfalse() + done() + }) + } catch (err) { + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) + done() + } + }) + + var getGeomagneticDipResult = [ 0.8760581016540527, 0.862170, -Infinity, 44330] + + /* + * @tc.name: Sensor_GetGeomagneticDip_001 * @tc.desc: Verfication results of the incorrect parameters of test interface. - * @tc.require: AR000GH2RP + * @tc.require: AR000GH2OG * @tc.author: */ - it('SensorJsTest_095', 0,async function (done) { - console.info('SensorJsTest_095 start') - sensor.createQuaternion([0.25, 0.14]).then((data) => { - console.info('SensorJsTest_095'); - expect(false).assertTrue(); - done() - },(error) => { - expect(true).assertTrue(); - console.info('promise failed') + it('Sensor_GetGeomagneticDip_001', 0, async function (done) { + console.info('Sensor_GetGeomagneticDip_001 start') + sensor.getInclination([1, 2, 3, 4, 5, 6, 7, 8, 9], (error, data) => { + if (error) { + console.info('Sensor_GetGeomagneticDip_001 failed'); + expect(false).assertTrue(); + } else { + console.info("Sensor_GetGeomagneticDip_001" + data) + expect(data).assertEqual(getGeomagneticDipResult[0]) + } done() + console.info('Sensor_GetGeomagneticDip_001' + 'lengh:' + data.length); }) + console.info("Sensor_GetGeomagneticDip_001 end") }) - let createRotationMatrixResult = [ - [0.6724675297737122,-0.10471208393573761,0.7326819896697998,0.06531608104705811,0.9944750070571899, - 0.08217836916446686,-0.7372390031814575,-0.007406365126371384,0.6755914688110352], - [1,0,0,0,1,0,0,0,1] - ] /* - * @tc.name: SensorJsTest_096 + * @tc.name: Sensor_GetGeomagneticDip_002 * @tc.desc: Verfication results of the incorrect parameters of test interface. - * @tc.require: AR000GH2RV + * @tc.require: AR000GH2OG * @tc.author: */ - it('SensorJsTest_096', 0, async function (done) { - console.info("SensorJsTest_096 start"); - sensor.createRotationMatrix([-0.0245, 0.402, 0.0465], (error, data) =>{ - console.info("SensorJsTest_096"); - if (error) { - console.info('SensorJsTest_096 failed'); - expect(false).assertTrue(); + it('Sensor_GetGeomagneticDip_002', 0, async function (done) { + console.info('Sensor_GetGeomagneticDip_002 start') + sensor.getInclination([1, 2, 3, 4], (error,data) => { + if (error) { + console.info('Sensor_GetGeomagneticDip_002 success'); + expect(true).assertTrue(); } else { - for(var i = 0;i < data.length; i++) { - console.info("SensorJsTest_096 [" + i + ") = " + data[i]); - expect(data[i]).assertEqual(createRotationMatrixResult[0][i]) - } + console.info("Sensor_GetGeomagneticDip_002 failed") + expect(false).assertTrue(); } - done() + done() }) - console.info(LABEL + "SensorJsTest_096 end"); + console.info("Sensor_GetGeomagneticDip_002 end") }) /* - * tc.name: SensorJsTest_097 - * tc.desc: Verfication results of the incorrect parameters of test interface. - * tc.require: SR000GH2A2 + * @tc.name: Sensor_GetGeomagneticDip_003 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_097', 0,async function (done) { - console.info('SensorJsTest_097 start') - sensor.createRotationMatrix([-0.0245, 0.402, 0.0465]).then((data) => { - for(var i = 0;i < data.length; i++) { - console.info("SensorJsTest_097 [" + i + "] : " + data[i]); - expect(data[i]).assertEqual(createRotationMatrixResult[0][i]) - } - done() - },(error) => { - expect(false).assertTrue(); - console.info('promise failed', error) - done() - }) - console.info( "SensorJsTest_097 end") + it('Sensor_GetGeomagneticDip_003', 0, async function (done) { + console.info('Sensor_GetGeomagneticDip_003 start') + try { + sensor.getInclination() + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_GetGeomagneticDip_003 end") }) /* - * tc.name: SensorJsTest_098 - * tc.desc: Verfication results of the incorrect parameters of test interface. - * tc.require: AR000GH2RV + * @tc.name: Sensor_GetGeomagneticDip_004 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_098', 0,async function (done) { - console.info('SensorJsTest_098 start') - sensor.createRotationMatrix([0, 0, 0]).then((data) => { - for(var i = 0;i < data.length; i++) { - console.info("SensorJsTest_098 [" + i + "] : " + data[i]); - expect(data[i]).assertEqual(createRotationMatrixResult[1][i]) - } - done() - }, (error) => { - expect(false).assertTrue(); - console.info('promise failed', error) - done() - }) - console.info( "SensorJsTest_098 end") + it('Sensor_GetGeomagneticDip_004', 0, async function (done) { + console.info('Sensor_GetGeomagneticDip_004 start') + try { + sensor.getInclination(-1, (error, data) => { + if (error) { + console.info('Sensor_GetGeomagneticDip_004 failed'); + expect(false).assertTrue(); + } else { + console.info("Sensor_GetGeomagneticDip_004" + data) + expect(data).assertEqual(getGeomagneticDipResult[0]) + } + done() + console.info('Sensor_GetGeomagneticDip_004' + 'lengh:' + data.length); + }) + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_GetGeomagneticDip_004 end") }) - var getGeomagneticDipResult = [ 0.8760581016540527, 0.862170, -Infinity, 44330] - /* - * @tc.name: SensorJsTest_099 + * @tc.name: Sensor_GetGeomagneticDip_005 * @tc.desc: Verfication results of the incorrect parameters of test interface. - * @tc.require: AR000GH2OG + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_099', 0, async function (done) { - console.info('SensorJsTest_099 start') - sensor.getGeomagneticDip([1, 2, 3, 4, 5, 6, 7, 8, 9], (error, data) => { - if (error) { - console.info('SensorJsTest_099 failed'); - expect(false).assertTrue(); - } else { - console.info("SensorJsTest_099" + data) - expect(data).assertEqual(getGeomagneticDipResult[0]) - } - done() - console.info('SensorJsTest_099' + 'lengh:' + data.length); - }) - console.info("SensorJsTest_099 end") + it('Sensor_GetGeomagneticDip_005', 0, async function (done) { + console.info('Sensor_GetGeomagneticDip_005 start') + try { + sensor.getInclination().then((data)=>{ + console.info("Sensor_GetGeomagneticDip_005" + data) + expect(true).assertfalse() + done() + }, (error)=>{ + expect(true).assertfalse() + done() + }) + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_GetGeomagneticDip_005 end") }) /* - * @tc.name: SensorJsTest_100 + * @tc.name: Sensor_GetGeomagneticDip_006 * @tc.desc: Verfication results of the incorrect parameters of test interface. - * @tc.require: AR000GH2OG + * @tc.require: I5SWJI * @tc.author: */ - it('SensorJsTest_100', 0, async function (done) { - console.info('SensorJsTest_100 start') - sensor.getGeomagneticDip([1, 2, 3, 4], (error,data) => { - if (error) { - console.info('SensorJsTest_100 success'); - expect(true).assertTrue(); - } else { - console.info("SensorJsTest_100 failed") - expect(false).assertTrue(); - } - done() - }) - console.info("SensorJsTest_100 end") + it('Sensor_GetGeomagneticDip_006', 0, async function (done) { + console.info('Sensor_GetGeomagneticDip_006 start') + try { + sensor.getInclination(-1).then((data)=>{ + console.info("Sensor_GetGeomagneticDip_006" + data) + expect(true).assertfalse() + done() + }, (error)=>{ + expect(true).assertfalse() + done() + }) + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_GetGeomagneticDip_006 end") }) /* - * @tc.name: SensorJsTest_101 + * @tc.name: Sensor_GetAltitude_001 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2OG * @tc.author: */ - it('SensorJsTest_101', 0, async function (done) { - console.info('SensorJsTest_101 start') - sensor.getAltitude(0, 100, (error, data) => { - if (error) { - console.info('SensorJsTest_101 failed'); + it('Sensor_GetAltitude_001', 0, async function (done) { + console.info('Sensor_GetAltitude_001 start') + sensor.getDeviceAltitude(0, 100, (error, data) => { + if (error) { + console.info('Sensor_GetAltitude_001 failed'); expect(false).assertTrue(); } else { - console.info("SensorJsTest_101" + data) - expect(data).assertEqual(getGeomagneticDipResult[2]) + console.info("Sensor_GetAltitude_001" + data) + expect(data).assertEqual(getGeomagneticDipResult[2]) } done() - console.info("SensorJsTest_101 end") + console.info("Sensor_GetAltitude_001 end") }) }) /* - * @tc.name: SensorJsTest_102 + * @tc.name: Sensor_GetAltitude_002 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2OG * @tc.author: */ - it('SensorJsTest_102', 0, async function (done) { - console.info('SensorJsTest_102 start') - sensor.getAltitude(5, 0, (error, data) => { - if (error) { - console.info('SensorJsTest_102 failed'); + it('Sensor_GetAltitude_002', 0, async function (done) { + console.info('Sensor_GetAltitude_002 start') + sensor.getDeviceAltitude(5, 0, (error, data) => { + if (error) { + console.info('Sensor_GetAltitude_002 failed'); expect(false).assertTrue(); } else { - console.info("SensorJsTest_102" + data) - expect(data).assertEqual(getGeomagneticDipResult[3]) + console.info("Sensor_GetAltitude_002" + data) + expect(data).assertEqual(getGeomagneticDipResult[3]) } done() }) - console.info("SensorJsTest_102 end") + console.info("Sensor_GetAltitude_002 end") }) /* - * @tc.name: SensorJsTest_103 + * @tc.name: Sensor_GetAltitude_003 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2OG * @tc.author: */ - it('SensorJsTest_103', 0, async function (done) { - sensor.getAltitude(0, 100).then((data)=>{ - console.info("SensorJsTest_102" + data) + it('Sensor_GetAltitude_003', 0, async function (done) { + sensor.getDeviceAltitude(0, 100).then((data)=>{ + console.info("Sensor_GetAltitude_003" + data) expect(data).assertEqual(getGeomagneticDipResult[2]) done() }, (error)=>{ - console.info('SensorJsTest_103 failed'); + console.info('Sensor_GetAltitude_003 failed'); expect(false).assertTrue(); done() }); }) /* - * @tc.name: SensorJsTest_104 + * @tc.name: Sensor_GetAltitude_004 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2OG * @tc.author: */ - it('SensorJsTest_104', 0, async function (done) { - sensor.getAltitude(5, 0).then((data)=>{ - console.info("SensorJsTest_104" + data) + it('Sensor_GetAltitude_004', 0, async function (done) { + sensor.getDeviceAltitude(5, 0).then((data)=>{ + console.info("Sensor_GetAltitude_004" + data) expect(data).assertEqual(getGeomagneticDipResult[3]) done() }, (error)=>{ - console.info('SensorJsTest_104 failed'); + console.info('Sensor_GetAltitude_004 failed'); expect(false).assertTrue(); done() }); }) + /* + * @tc.name: Sensor_GetAltitude_005 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetAltitude_005', 0, async function (done) { + console.info('Sensor_GetAltitude_005 start') + try { + sensor.getDeviceAltitude() + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_GetAltitude_005 end") + }) + + /* + * @tc.name: Sensor_GetAltitude_006 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetAltitude_006', 0, async function (done) { + console.info('Sensor_GetAltitude_006 start') + try { + sensor.getDeviceAltitude("invalid", 0, (error, data) => { + if (error) { + console.info('Sensor_GetAltitude_006 failed'); + expect(false).assertTrue(); + } else { + console.info("Sensor_GetAltitude_006" + data) + expect(data).assertEqual(getGeomagneticDipResult[0]) + } + done() + console.info('Sensor_GetAltitude_006' + 'lengh:' + data.length); + }) + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_GetGeomagneticDip_004 end") + }) + + /* + * @tc.name: Sensor_GetAltitude_007 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetAltitude_007', 0, async function (done) { + console.info('Sensor_GetAltitude_007 start') + try { + sensor.getDeviceAltitude().then((data)=>{ + console.info("Sensor_GetAltitude_007" + data) + expect(true).assertfalse() + done() + }, (error)=>{ + expect(true).assertfalse() + done() + }) + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_GetAltitude_007 end") + }) + + /* + * @tc.name: Sensor_GetAltitude_008 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_GetAltitude_008', 0, async function (done) { + console.info('Sensor_GetAltitude_008 start') + try { + sensor.getDeviceAltitude("invalid", 0).then((data)=>{ + console.info("Sensor_GetAltitude_008" + data) + expect(true).assertfalse() + done() + }, (error)=>{ + expect(true).assertfalse() + done() + }) + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_GetAltitude_008 end") + }) + let transformCoordinateSystemResult = [ [1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000], [340282001837565600000000000000000000000.000000, 340282001837565600000000000000000000000.000000, 340282001837565600000000000000000000000.000000, @@ -2522,19 +3426,19 @@ describe("SensorJsTest", function () { [Infinity, -Infinity, Infinity, Infinity, -Infinity, Infinity, Infinity, -Infinity, Infinity]] /* - * @tc.name: SensorJsTest_105 + * @tc.name: Sensor_TransformCoordinateSystem_001 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2TR * @tc.author: */ - it('SensorJsTest_105', 0, async function (done) { - console.info("---------------------------SensorJsTest_105----------------------------------"); - sensor.transformCoordinateSystem([1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], {'axisX':1, 'axisY':2}, (error, data) => { + it('Sensor_TransformCoordinateSystem_001', 0, async function (done) { + console.info("---------------------------Sensor_TransformCoordinateSystem_001----------------------------------"); + sensor.transformRotationMatrix([1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], {'axisX':1, 'axisY':2}, (error, data) => { if (error) { - console.info('SensorJsTest_105 failed'); + console.info('Sensor_TransformCoordinateSystem_001 failed'); expect(false).assertTrue(); } else { - console.info("SensorJsTest_105 " + JSON.stringify(data)); + console.info("Sensor_TransformCoordinateSystem_001 " + JSON.stringify(data)); expect(JSON.stringify(data)).assertEqual(JSON.stringify(transformCoordinateSystemResult[0])) } done() @@ -2542,19 +3446,19 @@ describe("SensorJsTest", function () { }) /* - * @tc.name: SensorJsTest_106 + * @tc.name: Sensor_TransformCoordinateSystem_002 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2TR * @tc.author: */ - it('SensorJsTest_106', 0, async function (done) { - console.info("---------------------------SensorJsTest_106----------------------------------"); - sensor.transformCoordinateSystem([3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38], {'axisX':1, 'axisY':2}, (error, data) => { + it('Sensor_TransformCoordinateSystem_002', 0, async function (done) { + console.info("---------------------------Sensor_TransformCoordinateSystem_002----------------------------------"); + sensor.transformRotationMatrix([3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38], {'axisX':1, 'axisY':2}, (error, data) => { if (error) { - console.info('SensorJsTest_106 failed'); + console.info('Sensor_TransformCoordinateSystem_002 failed'); expect(false).assertTrue(); } else { - console.info("SensorJsTest_106 " + JSON.stringify(data)); + console.info("Sensor_TransformCoordinateSystem_002 " + JSON.stringify(data)); expect(JSON.stringify(data)).assertEqual(JSON.stringify(transformCoordinateSystemResult[1])) } done() @@ -2562,169 +3466,328 @@ describe("SensorJsTest", function () { }) /* - * @tc.name: SensorJsTest_107 + * @tc.name: Sensor_TransformCoordinateSystem_003 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2TR * @tc.author: */ - it("SensorJsTest_107", 0, async function (done) { - console.info("---------------------------SensorJsTest_107----------------------------------"); - sensor.transformCoordinateSystem([1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], {'axisX':1, 'axisY':2}).then((data) => { + it("Sensor_TransformCoordinateSystem_003", 0, async function (done) { + console.info("---------------------------Sensor_TransformCoordinateSystem_003----------------------------------"); + sensor.transformRotationMatrix([1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], {'axisX':1, 'axisY':2}).then((data) => { for (var i = 0; i < data.length; i++) { - console.info("SensorJsTest_107 data[ " + i + "] = " + data[i]); + console.info("Sensor_TransformCoordinateSystem_003 data[ " + i + "] = " + data[i]); expect(data[i]).assertEqual(transformCoordinateSystemResult[0][i]); } done() }, (error)=>{ - console.info('SensorJsTest_107 failed'); + console.info('Sensor_TransformCoordinateSystem_003 failed'); expect(false).assertTrue(); done() }); }) /* - * @tc.name: SensorJsTest_108 + * @tc.name: Sensor_TransformCoordinateSystem_004 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2TR * @tc.author: */ - it("SensorJsTest_108", 0, async function (done) { - console.info("---------------------------SensorJsTest_108----------------------------------"); - sensor.transformCoordinateSystem([3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39], {'axisX':1, 'axisY':3}).then((data) => { + it("Sensor_TransformCoordinateSystem_004", 0, async function (done) { + console.info("---------------------------Sensor_TransformCoordinateSystem_004----------------------------------"); + sensor.transformRotationMatrix([3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39], {'axisX':1, 'axisY':3}).then((data) => { for (var i = 0; i < data.length; i++) { - console.info("SensorJsTest_108 data[ " + i + "] = " + data[i]); + console.info("Sensor_TransformCoordinateSystem_004 data[ " + i + "] = " + data[i]); expect(data[i]).assertEqual(transformCoordinateSystemResult[2][i]); } done() }, (error)=>{ - console.info('SensorJsTest_108 failed'); + console.info('Sensor_TransformCoordinateSystem_004 failed'); expect(false).assertTrue(); done() }); }) /* - * @tc.name: SensorJsTest_109 + * @tc.name: Sensor_TransformCoordinateSystem_005 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_TransformCoordinateSystem_005', 0, async function (done) { + console.info('Sensor_TransformCoordinateSystem_005 start') + try { + sensor.transformRotationMatrix() + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_TransformCoordinateSystem_005 end") + }) + + /* + * @tc.name: Sensor_TransformCoordinateSystem_006 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_TransformCoordinateSystem_006', 0, async function (done) { + console.info('Sensor_TransformCoordinateSystem_006 start') + try { + sensor.transformRotationMatrix("invalid", 0, (error, data) => { + if (error) { + console.info('Sensor_TransformCoordinateSystem_006 failed'); + expect(false).assertTrue(); + } else { + console.info("Sensor_TransformCoordinateSystem_006" + data) + expect(data).assertEqual(getGeomagneticDipResult[0]) + } + done() + console.info('Sensor_TransformCoordinateSystem_006' + 'lengh:' + data.length); + }) + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_GetGeomagneticDip_004 end") + }) + + /* + * @tc.name: Sensor_TransformCoordinateSystem_007 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_TransformCoordinateSystem_007', 0, async function (done) { + console.info('Sensor_TransformCoordinateSystem_007 start') + try { + sensor.transformRotationMatrix().then((data)=>{ + console.info("Sensor_TransformCoordinateSystem_007" + data) + expect(true).assertfalse() + done() + }, (error)=>{ + expect(true).assertfalse() + done() + }) + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_TransformCoordinateSystem_007 end") + }) + + /* + * @tc.name: Sensor_TransformCoordinateSystem_008 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: I5SWJI + * @tc.author: + */ + it('Sensor_TransformCoordinateSystem_008', 0, async function (done) { + console.info('Sensor_TransformCoordinateSystem_008 start') + try { + sensor.transformRotationMatrix("invalid", 0).then((data)=>{ + console.info("Sensor_TransformCoordinateSystem_008" + data) + expect(true).assertfalse() + done() + }, (error)=>{ + expect(true).assertfalse() + done() + }) + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + console.info("Sensor_TransformCoordinateSystem_008 end") + }) + + /* + * @tc.name: Sensor_GetSensorList_001 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2TR * @tc.author: */ - it("SensorJsTest_109", 0, async function (done) { - console.info("---------------------------SensorJsTest_109----------------------------------"); + it("Sensor_GetSensorList_001", 0, async function (done) { + console.info("---------------------------Sensor_GetSensorList_001----------------------------------"); sensor.getSensorList().then((data) => { - console.info("---------------------------SensorJsTest_109 callback in-----------" + data.length); + console.info("---------------------------Sensor_GetSensorList_001 callback in-----------" + data.length); for (var i = 0; i < data.length; i++) { - console.info("SensorJsTest_109 " + JSON.stringify(data[i])); + console.info("Sensor_GetSensorList_001 " + JSON.stringify(data[i])); } expect(true).assertTrue(); done(); }, (error)=>{ - console.info('SensorJsTest_109 failed'); + console.info('Sensor_GetSensorList_001 failed'); expect(false).assertTrue(); done(); }); }) /* - * @tc.name: SensorJsTest_110 + * @tc.name: Sensor_GetSensorList_002 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2TR * @tc.author: */ - it("SensorJsTest_110", 0, async function (done) { - console.info("---------------------------SensorJsTest_110----------------------------------"); + it("Sensor_GetSensorList_002", 0, async function (done) { + console.info("---------------------------Sensor_GetSensorList_002----------------------------------"); sensor.getSensorList((error, data) => { if (error) { - console.info('SensorJsTest_110 failed'); + console.info('Sensor_GetSensorList_002 failed'); expect(false).assertTrue(); } else { - console.info("---------------------------SensorJsTest_110 callback in-----------" + data.length); + console.info("---------------------------Sensor_GetSensorList_002 callback in-----------" + data.length); for (var i = 0; i < data.length; i++) { - console.info("SensorJsTest_110 " + JSON.stringify(data[i])); + console.info("Sensor_GetSensorList_002 " + JSON.stringify(data[i])); } expect(true).assertTrue(); } - done() + done(); }); }) /* - * @tc.name: SensorJsTest_111 + * @tc.name: Sensor_GetSensorList_003 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: AR000GH2TR + * @tc.author: + */ + it("Sensor_GetSensorList_003", 0, async function (done) { + console.info("---------------------------Sensor_GetSensorList_003----------------------------------"); + try { + sensor.getSensorList(-1); + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + }) + + /* + * @tc.name: Sensor_GetSensorList_004 + * @tc.desc: Verfication results of the incorrect parameters of test interface. + * @tc.require: AR000GH2TR + * @tc.author: + */ + it("Sensor_GetSensorList_004", 0, async function (done) { + console.info("---------------------------Sensor_GetSensorList_004----------------------------------"); + try { + sensor.getSensorList(-1).then(data => { + console.info("Sensor_GetSingleSensor_003 " + JSON.stringify(data)); + expect(true).assertTrue(); + done(); + }), (error => { + console.info(error); + expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE); + expect(error.code).assertEqual(SERVICE_EXCEPTION_MSG); + done(); + }); + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + }) + + /* + * @tc.name: Sensor_GetSingleSensor_001 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2TR * @tc.author: */ - it("SensorJsTest_111", 0, async function (done) { - console.info("---------------------------SensorJsTest_111----------------------------------"); - sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, (error, data) => { + it("Sensor_GetSingleSensor_001", 0, async function (done) { + console.info("---------------------------Sensor_GetSingleSensor_001----------------------------------"); + sensor.getSingleSensor(sensor.SensorId.ACCELEROMETER, (error, data) => { if (error) { - console.info('SensorJsTest_111 failed'); + console.info('Sensor_GetSingleSensor_001 failed'); expect(false).assertTrue(); } else { - console.info("---------------------------SensorJsTest_111 callback in-----------" + data.length); - console.info("SensorJsTest_111 " + JSON.stringify(data)); + console.info("---------------------------Sensor_GetSingleSensor_001 callback in-----------" + data.length); + console.info("Sensor_GetSingleSensor_001 " + JSON.stringify(data)); expect(true).assertTrue(); } - done() + done(); }); }) /* - * @tc.name: SensorJsTest_112 + * @tc.name: Sensor_GetSingleSensor_002 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2TR * @tc.author: */ - it("SensorJsTest_112", 0, async function (done) { - console.info("---------------------------SensorJsTest_112----------------------------------"); - sensor.getSingleSensor(-1, (error, data) => { - if (error) { - console.info('SensorJsTest_112 failed'); - expect(true).assertTrue(); - } else { - console.info("---------------------------SensorJsTest_112 callback in-----------" + data.length); - console.info("SensorJsTest_112 " + JSON.stringify(data)); - expect(false).assertTrue(); - } - done() - }); + it("Sensor_GetSingleSensor_002", 0, async function (done) { + console.info("---------------------------Sensor_GetSingleSensor_002----------------------------------"); + try { + sensor.getSingleSensor(-1, (error, data) => { + if (error) { + console.info('Sensor_GetSingleSensor_002 failed'); + expect(true).assertTrue(); + } else { + console.info("---------------------------Sensor_GetSingleSensor_002 callback in-----------" + data.length); + console.info("Sensor_GetSingleSensor_002 " + JSON.stringify(data)); + expect(false).assertTrue(); + } + done(); + }); + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } }) /* - * @tc.name: SensorJsTest_113 + * @tc.name: Sensor_GetSingleSensor_003 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2TR * @tc.author: */ - it("SensorJsTest_113", 0, async function (done) { - console.info("---------------------------SensorJsTest_113----------------------------------"); - sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER).then((data) => { - console.info("SensorJsTest_113 " + JSON.stringify(data)); + it("Sensor_GetSingleSensor_003", 0, async function (done) { + console.info("---------------------------SensorJsTest_114----------------------------------"); + sensor.getSingleSensor(sensor.SensorId.ACCELEROMETER).then((data) => { + console.info("Sensor_GetSingleSensor_003 " + JSON.stringify(data)); expect(true).assertTrue(); - done() + done(); }, (error)=>{ - console.info('SensorJsTest_113 failed'); + console.info('Sensor_GetSingleSensor_003 failed'); expect(false).assertTrue(); - done() + done(); }); }) /* - * @tc.name: SensorJsTest_114 + * @tc.name: Sensor_GetSingleSensor_004 * @tc.desc: Verfication results of the incorrect parameters of test interface. * @tc.require: AR000GH2TR * @tc.author: */ - it("SensorJsTest_114", 0, async function (done) { - console.info("---------------------------SensorJsTest_114----------------------------------"); - sensor.getSingleSensor(-1).then((data) => { - console.info("SensorJsTest_114 " + JSON.stringify(data)); - expect(false).assertTrue(); - done() - }, (error)=>{ - console.info('SensorJsTest_114 success'); - expect(true).assertTrue(); - done() - }); + it("Sensor_GetSingleSensor_004", 0, async function (done) { + console.info("---------------------------Sensor_GetSingleSensor_004----------------------------------"); + try { + sensor.getSingleSensor(-1).then((data) => { + console.info("Sensor_GetSingleSensor_004 " + JSON.stringify(data)); + expect(false).assertTrue(); + done(); + }, (error)=>{ + console.info('Sensor_GetSingleSensor_004 success'); + expect(true).assertTrue(); + done(); + }); + } catch(error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } }) }) -- Gitee