Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e5b65124
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
e5b65124
编写于
4月 10, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 10, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8408 修复sensor算法模块用例失败
Merge pull request !8408 from ZhaoMinghui/zmh0410
上级
0fec4e86
ba8b5b69
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
231 addition
and
276 deletion
+231
-276
sensors/sensor_standard/src/main/js/test/SensorGeneralalgorithm.test.js
..._standard/src/main/js/test/SensorGeneralalgorithm.test.js
+10
-1
sensors/sensor_standard/src/main/js/test/SensorGeomagneticTest.test.js
...r_standard/src/main/js/test/SensorGeomagneticTest.test.js
+107
-168
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newSensorGeomagnetic.js
...main/js/test/SensorOnOffTest.test_newSensorGeomagnetic.js
+114
-107
未找到文件。
sensors/sensor_standard/src/main/js/test/SensorGeneralalgorithm.test.js
浏览文件 @
e5b65124
...
...
@@ -119,6 +119,8 @@ describe("SensorJsTest_sensor_1", function () {
[
30
,
25
,
41
],
[
3
,
2
,
4
],
[
-
123
,
-
456
,
-
564
],
[
3.40282
e
+
38
,
3.40282
e
+
38
,
3.40282
e
+
38
],
[
NaN
,
NaN
,
NaN
]
]
const
EPS
=
0.01
/*
* @tc.name:SensorJsTest_068
* @tc.desc:Verification results of the incorrect parameters of the test interface.
...
...
@@ -219,7 +221,14 @@ describe("SensorJsTest_sensor_1", function () {
it
(
'
SensorJsTest_073
'
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
sensor
.
createRotationMatrix
(
gravity
[
1
],
geomagnetic
[
1
]).
then
((
data
)
=>
{
console
.
info
(
"
SensorJsTest_073
"
+
JSON
.
stringify
(
data
))
expect
(
JSON
.
stringify
(
data
)).
assertEqual
(
JSON
.
stringify
(
SENSOR_DATA_MATRIX
[
1
]))
expect
(
data
.
rotation
.
length
).
assertEqual
(
SENSOR_DATA_MATRIX
[
1
].
rotation
.
length
)
for
(
let
i
=
0
;
i
<
data
.
rotation
.
length
;
++
i
)
{
expect
(
Math
.
abs
(
data
.
rotation
[
i
]
-
SENSOR_DATA_MATRIX
[
1
].
rotation
[
i
])
<
EPS
).
assertTrue
()
}
expect
(
data
.
inclination
.
length
).
assertEqual
(
SENSOR_DATA_MATRIX
[
1
].
inclination
.
length
)
for
(
let
i
=
0
;
i
<
data
.
inclination
.
length
;
++
i
)
{
expect
(
Math
.
abs
(
data
.
inclination
[
i
]
-
SENSOR_DATA_MATRIX
[
1
].
inclination
[
i
])
<
EPS
).
assertTrue
()
}
done
()
},
(
error
)
=>
{
expect
(
false
).
assertTrue
();
...
...
sensors/sensor_standard/src/main/js/test/SensorGeomagneticTest.test.js
浏览文件 @
e5b65124
...
...
@@ -82,6 +82,8 @@ describe("SensorJsTest_sensor_2", function () {
let
timeMillis
=
[
1580486400000
,
1612108800000
,
1643644800000
,
1675180800000
,
1706716800000
]
const
EPS
=
0.01
/**
* @tc.number:SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0010
* @tc.name: SensorGeomagenticAlgorithmJSTest001
...
...
@@ -106,13 +108,13 @@ describe("SensorJsTest_sensor_2", function () {
+
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
]
)
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
2
]
)
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
3
]
)
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
4
]
)
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
5
]
)
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
6
]
)
expect
(
Math
.
abs
(
data
.
x
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
6
])
<
EPS
).
assertTrue
(
)
setTimeout
(()
=>
{
resolve
()
},
500
)
...
...
@@ -150,13 +152,13 @@ describe("SensorJsTest_sensor_2", function () {
+
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
]
)
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
2
]
)
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
3
]
)
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
4
]
)
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
5
]
)
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
6
]
)
expect
(
Math
.
abs
(
data
.
x
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
6
])
<
EPS
).
assertTrue
(
)
setTimeout
(()
=>
{
resolve
()
},
500
)
...
...
@@ -167,40 +169,6 @@ describe("SensorJsTest_sensor_2", function () {
Promise
.
all
(
promiseArray
).
then
(
done
)
})
/**
* @tc.number:SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0030
* @tc.name: SensorGeomagenticAlgorithmJSTest003
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
SensorGeomagenticAlgorithmJSTest003
'
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------SensorGeomagenticAlgorithmJSTest003-------------------------
"
);
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
)
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest003 failed
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
SensorGeomagenticAlgorithmJSTest003 x:
'
+
data
.
x
+
'
,y:
'
+
data
.
y
+
'
,z:
'
+
data
.
z
+
'
,geomagneticDip:
'
+
data
.
geomagneticDip
+
'
,deflectionAngle:
'
+
data
.
deflectionAngle
+
'
,levelIntensity:
'
+
data
.
levelIntensity
+
'
,totalIntensity:
'
+
data
.
totalIntensity
)
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
()
},
500
)
})
})
/**
* @tc.number:SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0040
* @tc.name: SensorGeomagenticAlgorithmJSTest004
...
...
@@ -221,13 +189,13 @@ describe("SensorJsTest_sensor_2", 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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}
setTimeout
(()
=>
{
done
()
...
...
@@ -254,13 +222,13 @@ describe("SensorJsTest_sensor_2", 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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}
setTimeout
(()
=>
{
done
()
...
...
@@ -287,13 +255,13 @@ describe("SensorJsTest_sensor_2", 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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}
setTimeout
(()
=>
{
done
()
...
...
@@ -321,13 +289,13 @@ describe("SensorJsTest_sensor_2", 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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}
setTimeout
(()
=>
{
done
()
...
...
@@ -459,13 +427,13 @@ describe("SensorJsTest_sensor_2", 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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}
setTimeout
(()
=>
{
done
()
...
...
@@ -821,13 +789,13 @@ describe("SensorJsTest_sensor_2", function () {
+
'
,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
]
)
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
2
]
)
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
3
]
)
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
4
]
)
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
5
]
)
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
6
]
)
expect
(
Math
.
abs
(
data
.
x
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
})
...
...
@@ -835,35 +803,6 @@ describe("SensorJsTest_sensor_2", function () {
done
()
})
/**
* @tc.number:SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0270
* @tc.name: SensorGeomagenticAlgorithmJSTest027
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
"
SensorGeomagenticAlgorithmJSTest027
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
'
------------------SensorGeomagenticAlgorithmJSTest027------------------
'
);
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
(
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
)
});
done
()
})
/**
* @tc.number:SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0280
* @tc.name: SensorGeomagenticAlgorithmJSTest028
...
...
@@ -879,13 +818,13 @@ describe("SensorJsTest_sensor_2", 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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
});
...
...
@@ -907,13 +846,13 @@ describe("SensorJsTest_sensor_2", 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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
});
...
...
@@ -935,13 +874,13 @@ describe("SensorJsTest_sensor_2", 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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
});
...
...
@@ -963,13 +902,13 @@ describe("SensorJsTest_sensor_2", 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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
});
...
...
@@ -1072,13 +1011,13 @@ describe("SensorJsTest_sensor_2", 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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
});
...
...
@@ -1139,13 +1078,13 @@ describe("SensorJsTest_sensor_2", function () {
+
'
,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
]
)
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
2
]
)
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
3
]
)
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
4
]
)
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
5
]
)
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
6
]
)
expect
(
Math
.
abs
(
data
.
x
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
)
});
...
...
@@ -1270,13 +1209,13 @@ describe("SensorJsTest_sensor_2", function () {
+
'
,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
]
)
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
2
]
)
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
3
]
)
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
4
]
)
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
5
]
)
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
6
]
)
expect
(
Math
.
abs
(
data
.
x
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
promise::catch
"
,
error
);
});
...
...
sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_newSensorGeomagnetic.js
浏览文件 @
e5b65124
...
...
@@ -55,7 +55,7 @@ describe("SensorJsTest_sensor_60", function () {
const
SERVICE_EXCEPTION_CODE
=
14500101
const
PARAMETER_ERROR_MSG
=
'
The parameter invalid.
'
const
SERVICE_EXCEPTION_MSG
=
'
Service exception.
'
const
EPS
=
0.01
let
GEOMAGNETIC_COMPONENT_YEAR_RESULT
=
[
[
6570.3935546875
,
-
146.3289337158203
,
54606.0078125
,
-
1.2758207321166992
,
83.13726043701172
,
6572.02294921875
,
55000.0703125
],
[
6554.17041015625
,
-
87.19947052001953
,
54649.078125
,
-
0.7622424364089966
,
83.16046905517578
,
6554.75048828125
,
55040.7734375
],
...
...
@@ -99,13 +99,13 @@ describe("SensorJsTest_sensor_60", function () {
}
else
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
2
]
)
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
3
]
)
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
4
]
)
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
5
]
)
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
6
]
)
expect
(
Math
.
abs
(
data
.
x
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
j
][
6
])
<
EPS
).
assertTrue
(
)
setTimeout
(()
=>
{
resolve
()
},
500
)
...
...
@@ -138,13 +138,13 @@ describe("SensorJsTest_sensor_60", function () {
}
else
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
2
]
)
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
3
]
)
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
4
]
)
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
5
]
)
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
6
]
)
expect
(
Math
.
abs
(
data
.
x
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
j
][
6
])
<
EPS
).
assertTrue
(
)
setTimeout
(()
=>
{
resolve
()
},
500
)
...
...
@@ -171,13 +171,13 @@ describe("SensorJsTest_sensor_60", function () {
}
else
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}
setTimeout
(()
=>
{
done
()
...
...
@@ -200,13 +200,13 @@ describe("SensorJsTest_sensor_60", function () {
}
else
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}
setTimeout
(()
=>
{
done
()
...
...
@@ -229,13 +229,13 @@ describe("SensorJsTest_sensor_60", function () {
}
else
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}
setTimeout
(()
=>
{
done
()
...
...
@@ -258,13 +258,13 @@ describe("SensorJsTest_sensor_60", function () {
}
else
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}
setTimeout
(()
=>
{
done
()
...
...
@@ -375,13 +375,13 @@ describe("SensorJsTest_sensor_60", function () {
}
else
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}
setTimeout
(()
=>
{
done
()
...
...
@@ -686,13 +686,13 @@ describe("SensorJsTest_sensor_60", function () {
await
sensor
.
getGeomagneticInfo
({
'
latitude
'
:
80
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
i
]).
then
((
data
)
=>
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
2
]
)
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
3
]
)
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
4
]
)
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
5
]
)
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
6
]
)
expect
(
Math
.
abs
(
data
.
x
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
Sensor_GetGeomagneticInfo_025 promise::catch
"
+
error
);
})
...
...
@@ -711,13 +711,13 @@ describe("SensorJsTest_sensor_60", function () {
await
sensor
.
getGeomagneticInfo
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
Number
.
MIN_VALUE
).
then
((
data
)
=>
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
Sensor_GetGeomagneticInfo_026 promise::catch
"
+
error
);
});
...
...
@@ -735,13 +735,13 @@ describe("SensorJsTest_sensor_60", function () {
await
sensor
.
getGeomagneticInfo
({
'
latitude
'
:
Number
.
MAX_VALUE
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
Sensor_GetGeomagneticInfo_027 promise::catch
"
+
error
)
});
...
...
@@ -759,13 +759,13 @@ describe("SensorJsTest_sensor_60", function () {
await
sensor
.
getGeomagneticInfo
({
'
latitude
'
:
Number
.
NaN
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
Sensor_GetGeomagneticInfo_028 promise::catch
"
+
error
)
});
...
...
@@ -783,13 +783,13 @@ describe("SensorJsTest_sensor_60", function () {
await
sensor
.
getGeomagneticInfo
({
'
latitude
'
:
Number
.
NEGATIVE_INFINITY
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
Sensor_GetGeomagneticInfo_029 promise::catch
"
+
error
)
});
...
...
@@ -876,13 +876,13 @@ describe("SensorJsTest_sensor_60", function () {
await
sensor
.
getGeomagneticInfo
({
'
latitude
'
:
0
,
'
longitude
'
:
0
,
'
altitude
'
:
Number
.
MIN_VALUE
},
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
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
(
Math
.
abs
(
data
.
x
-
geomagneticComponent
[
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
geomagneticComponent
[
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
geomagneticComponent
[
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
geomagneticComponent
[
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
geomagneticComponent
[
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
geomagneticComponent
[
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
geomagneticComponent
[
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
Sensor_GetGeomagneticInfo_034 promise::catch
"
+
error
)
});
...
...
@@ -934,13 +934,13 @@ describe("SensorJsTest_sensor_60", function () {
await
sensor
.
getGeomagneticInfo
({
'
latitude
'
:
80
,
'
longitude
'
:
0
,
'
altitude
'
:
0
},
timeMillis
[
i
]).
then
((
data
)
=>
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
2
]
)
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
3
]
)
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
4
]
)
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
5
]
)
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
6
]
)
expect
(
Math
.
abs
(
data
.
x
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
GEOMAGNETIC_COMPONENT_YEAR_RESULT
[
i
][
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
Sensor_GetGeomagneticInfo_037 promise::catch
"
+
error
)
});
...
...
@@ -1045,13 +1045,13 @@ describe("SensorJsTest_sensor_60", function () {
'
altitude
'
:
GEOMAGNETIC_COORDINATES
[
i
][
2
]},
timeMillis
[
0
]).
then
((
data
)
=>
{
console
.
info
(
'
Sensor_GetGeomagneticInfo_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
]
)
expect
(
data
.
z
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
2
]
)
expect
(
data
.
deflectionAngle
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
3
]
)
expect
(
data
.
geomagneticDip
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
4
]
)
expect
(
data
.
levelIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
5
]
)
expect
(
data
.
totalIntensity
).
assertEqual
(
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
6
]
)
expect
(
Math
.
abs
(
data
.
x
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
0
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
y
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
1
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
z
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
2
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
deflectionAngle
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
3
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
geomagneticDip
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
4
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
levelIntensity
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
5
])
<
EPS
).
assertTrue
(
)
expect
(
Math
.
abs
(
data
.
totalIntensity
-
GEOMAGNETIC_COMPONENT_COORDINATES_RESULT
[
i
][
6
])
<
EPS
).
assertTrue
(
)
}).
catch
((
error
)
=>
{
console
.
info
(
"
Sensor_GetGeomagneticInfo_043 promise::catch
"
+
error
);
});
...
...
@@ -1454,7 +1454,14 @@ describe("SensorJsTest_sensor_60", function () {
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
]))
expect
(
data
.
rotation
.
length
).
assertEqual
(
SENSOR_DATA_MATRIX
[
1
].
rotation
.
length
)
for
(
let
i
=
0
;
i
<
data
.
rotation
.
length
;
++
i
)
{
expect
(
Math
.
abs
(
data
.
rotation
[
i
]
-
SENSOR_DATA_MATRIX
[
1
].
rotation
[
i
])
<
EPS
).
assertTrue
()
}
expect
(
data
.
inclination
.
length
).
assertEqual
(
SENSOR_DATA_MATRIX
[
1
].
inclination
.
length
)
for
(
let
i
=
0
;
i
<
data
.
inclination
.
length
;
++
i
)
{
expect
(
Math
.
abs
(
data
.
inclination
[
i
]
-
SENSOR_DATA_MATRIX
[
1
].
inclination
[
i
])
<
EPS
).
assertTrue
()
}
done
()
},
(
error
)
=>
{
expect
(
false
).
assertTrue
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录