From ae593c1295d72bb71e7afa7dab3b47d6383f9076 Mon Sep 17 00:00:00 2001 From: lidanyang16 Date: Tue, 14 Feb 2023 17:20:26 +0800 Subject: [PATCH] Signed-off-by: lidanyang16 --- .../test/SensorGeneralalgorithm.test.js | 12 +++--- .../test/SensorGeomagneticTest.test.js | 38 ++++++++++--------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/sensors/sensor_standard/src/main/js/default/test/SensorGeneralalgorithm.test.js b/sensors/sensor_standard/src/main/js/default/test/SensorGeneralalgorithm.test.js index 190e22e7e..ac86e7805 100755 --- a/sensors/sensor_standard/src/main/js/default/test/SensorGeneralalgorithm.test.js +++ b/sensors/sensor_standard/src/main/js/default/test/SensorGeneralalgorithm.test.js @@ -991,8 +991,8 @@ describe("SensorJsTest_sensor5", function () { 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 + 'x': 1, + 'y': 2 }, (error, data) => { if (error) { console.info('SensorJsTest_107 failed'); @@ -1012,7 +1012,7 @@ describe("SensorJsTest_sensor5", function () { it('SensorJsTest_108', 0, async function (done) { console.info("---------------------------SensorJsTest_108----------------------------------"); 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) => { + 3.40282e+38, 3.40282e+38, 3.40282e+38], { 'x': 1, 'y': 2 }, (error, data) => { if (error) { console.info('SensorJsTest_108 failed'); expect(false).assertTrue(); @@ -1031,8 +1031,8 @@ describe("SensorJsTest_sensor5", function () { it("SensorJsTest_109", 0, async function (done) { console.info("---------------------------SensorJsTest_109----------------------------------"); sensor.transformCoordinateSystem([1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], { - 'axisX': 1, - 'axisY': 2 + 'x': 1, + 'y': 2 }).then((data) => { for (let i = 0; i < data.length; i++) { console.info("SensorJsTest_109 data[ " + i + "] = " + data[i]); @@ -1053,7 +1053,7 @@ describe("SensorJsTest_sensor5", function () { it("SensorJsTest_110", 0, async function (done) { console.info("---------------------------SensorJsTest_110----------------------------------"); 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) => { + 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39], { 'x': 1, 'y': 3 }).then((data) => { for (let i = 0; i < data.length; i++) { console.info("SensorJsTest_110 data[ " + i + "] = " + data[i]); expect(data[i]).assertEqual(transformCoordinateSystemResult[2][i]); diff --git a/sensors/sensor_standard/src/main/js/default/test/SensorGeomagneticTest.test.js b/sensors/sensor_standard/src/main/js/default/test/SensorGeomagneticTest.test.js index a15399e0a..df261a82e 100755 --- a/sensors/sensor_standard/src/main/js/default/test/SensorGeomagneticTest.test.js +++ b/sensors/sensor_standard/src/main/js/default/test/SensorGeomagneticTest.test.js @@ -173,8 +173,9 @@ describe("SensorJsTest_sensor6", function () { */ it('SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0030', 0, async function (done) { console.info("------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0030-------------------------"); - let geomagneticComponent = [27779.234375, -6214.9794921875, -14924.6611328125, -27.667943954467773, - -12.610970497131348, 28465.9765625, 32141.2109375] + let geomagneticComponent = [-1417119616, 23146989568, -6406359552, -15.442885398864746, + 93.50342559814453, 23190329344, 24058943488, 27779.234375, -6214.9794921875, -14924.6611328125, + -27.667943954467773, -12.610970497131348, 28465.9765625, 32141.2109375] sensor.getGeomagneticField({ 'latitude': 0, 'longitude': 0, 'altitude': 0 }, Number.MAX_VALUE, (error, data) => { if (error) { @@ -185,13 +186,13 @@ describe("SensorJsTest_sensor6", function () { + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) - expect(data.x).assertEqual(geomagneticComponent[0]) - expect(data.y).assertEqual(geomagneticComponent[1]) - expect(data.z).assertEqual(geomagneticComponent[2]) - expect(data.geomagneticDip).assertEqual(geomagneticComponent[3]) - expect(data.deflectionAngle).assertEqual(geomagneticComponent[4]) - expect(data.levelIntensity).assertEqual(geomagneticComponent[5]) - expect(data.totalIntensity).assertEqual(geomagneticComponent[6]) + expect(geomagneticComponent).assertContain(data.x) + expect(geomagneticComponent).assertContain(data.y) + expect(geomagneticComponent).assertContain(data.z) + expect(geomagneticComponent).assertContain(data.geomagneticDip) + expect(geomagneticComponent).assertContain(data.deflectionAngle) + expect(geomagneticComponent).assertContain(data.levelIntensity) + expect(geomagneticComponent).assertContain(data.totalIntensity) } setTimeout(() => { done() @@ -840,21 +841,22 @@ describe("SensorJsTest_sensor6", function () { */ it("SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0270", 0, async function (done) { console.info('------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0270------------------'); - let geomagneticComponent = [27779.234375, -6214.9794921875, -14924.6611328125, -27.667943954467773, - -12.610970497131348, 28465.9765625, 32141.2109375] + let geomagneticComponent = [-1417119616, 23146989568, -6406359552, -15.442885398864746, + 93.50342559814453, 23190329344, 24058943488, 27779.234375, -6214.9794921875, -14924.6611328125, + -27.667943954467773, -12.610970497131348, 28465.9765625, 32141.2109375] await sensor.getGeomagneticField({ 'latitude': 0, 'longitude': 0, 'altitude': 0 }, Number.MAX_VALUE).then((data) => { console.info('SensorGeomagenticAlgorithmJSTest027 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]) - expect(data.z).assertEqual(geomagneticComponent[2]) - expect(data.geomagneticDip).assertEqual(geomagneticComponent[3]) - expect(data.deflectionAngle).assertEqual(geomagneticComponent[4]) - expect(data.levelIntensity).assertEqual(geomagneticComponent[5]) - expect(data.totalIntensity).assertEqual(geomagneticComponent[6]) + expect(geomagneticComponent).assertContain(data.x) + expect(geomagneticComponent).assertContain(data.y) + expect(geomagneticComponent).assertContain(data.z) + expect(geomagneticComponent).assertContain(data.geomagneticDip) + expect(geomagneticComponent).assertContain(data.deflectionAngle) + expect(geomagneticComponent).assertContain(data.levelIntensity) + expect(geomagneticComponent).assertContain(data.totalIntensity) }).catch((error) => { console.info("promise::catch", error) }); -- GitLab