Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
510a5631
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看板
未验证
提交
510a5631
编写于
2月 16, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 16, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7612 Modified the static functions of rationalnumber
Merge pull request !7612 from jwx1068251/master
上级
f1c5b5c0
6566c22c
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
46 addition
and
90 deletion
+46
-90
commonlibrary/ets_utils/util2_lib_standard/src/main/js/test/util.test.js
...ts_utils/util2_lib_standard/src/main/js/test/util.test.js
+41
-80
commonlibrary/ets_utils/util_lib_standard/src/main/js/test/util.test.js
...ets_utils/util_lib_standard/src/main/js/test/util.test.js
+5
-10
未找到文件。
commonlibrary/ets_utils/util2_lib_standard/src/main/js/test/util.test.js
浏览文件 @
510a5631
...
@@ -3582,11 +3582,9 @@ describe('RationalNumberTest', function () {
...
@@ -3582,11 +3582,9 @@ describe('RationalNumberTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_parseRationalNumber_001
'
,
0
,
function
()
{
it
(
'
test_parseRationalNumber_001
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
parseRationalNumber
(
2
,
1
)
pro
.
parseRationalNumber
(
1
,
2
)
var
result
=
res
.
valueOf
()
var
res
=
pro
.
createRationalFromString
(
'
+2:-4
'
)
expect
(
result
).
assertEqual
(
2
)
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
-
0.5
)
})
})
/**
/**
...
@@ -3595,11 +3593,9 @@ describe('RationalNumberTest', function () {
...
@@ -3595,11 +3593,9 @@ describe('RationalNumberTest', function () {
*/
*/
it
(
'
test_parseRationalNumberThrowError_001
'
,
0
,
function
()
{
it
(
'
test_parseRationalNumberThrowError_001
'
,
0
,
function
()
{
try
{
try
{
var
pro
=
new
util
.
RationalNumber
()
var
pro
=
util
.
RationalNumber
.
parseRationalNumber
(
'
str
'
,
2
)
pro
.
parseRationalNumber
(
'
str
'
,
2
)
var
result
=
res
.
valueOf
()
var
res
=
pro
.
createRationalFromString
(
'
+2:-4
'
)
expect
(
result
).
assertEqual
(
2
)
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
-
0.5
)
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
BusinessError: Parameter error.The type of str must be number
"
);
expect
(
e
.
toString
()).
assertEqual
(
"
BusinessError: Parameter error.The type of str must be number
"
);
}
}
...
@@ -3610,11 +3606,9 @@ describe('RationalNumberTest', function () {
...
@@ -3610,11 +3606,9 @@ describe('RationalNumberTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_createRationalFromString_001
'
,
0
,
function
()
{
it
(
'
test_createRationalFromString_001
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
'
-1:2
'
)
pro
.
parseRationalNumber
(
1
,
2
)
var
result
=
res
.
valueOf
()
var
res
=
pro
.
createRationalFromString
(
'
-1:2
'
)
expect
(
result
).
assertEqual
(
-
0.5
)
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
-
0.5
)
})
})
/**
/**
...
@@ -3622,11 +3616,9 @@ describe('RationalNumberTest', function () {
...
@@ -3622,11 +3616,9 @@ describe('RationalNumberTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_createRationalFromString_002
'
,
0
,
function
()
{
it
(
'
test_createRationalFromString_002
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
'
+3/4
'
)
pro
.
parseRationalNumber
(
1
,
2
)
var
result
=
res
.
valueOf
()
var
res
=
pro
.
createRationalFromString
(
'
+3/4
'
)
expect
(
result
).
assertEqual
(
0.75
)
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
0.75
)
})
})
/**
/**
...
@@ -3634,11 +3626,9 @@ describe('RationalNumberTest', function () {
...
@@ -3634,11 +3626,9 @@ describe('RationalNumberTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_createRationalFromString_003
'
,
0
,
function
()
{
it
(
'
test_createRationalFromString_003
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
'
+3:-4
'
)
pro
.
parseRationalNumber
(
1
,
2
)
var
result
=
res
.
valueOf
()
var
res
=
pro
.
createRationalFromString
(
'
+3:-4
'
)
expect
(
result
).
assertEqual
(
-
0.75
)
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
-
0.75
)
})
})
/**
/**
...
@@ -3646,11 +3636,9 @@ describe('RationalNumberTest', function () {
...
@@ -3646,11 +3636,9 @@ describe('RationalNumberTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_createRationalFromString_004
'
,
0
,
function
()
{
it
(
'
test_createRationalFromString_004
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
'
+2:4
'
)
pro
.
parseRationalNumber
(
1
,
2
)
var
result
=
res
.
valueOf
()
var
res
=
pro
.
createRationalFromString
(
'
+2:4
'
)
expect
(
result
).
assertEqual
(
0.5
)
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
0.5
)
})
})
/**
/**
...
@@ -3658,11 +3646,9 @@ describe('RationalNumberTest', function () {
...
@@ -3658,11 +3646,9 @@ describe('RationalNumberTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_createRationalFromString_005
'
,
0
,
function
()
{
it
(
'
test_createRationalFromString_005
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
'
+2:-4
'
)
pro
.
parseRationalNumber
(
1
,
2
)
var
result
=
res
.
valueOf
()
var
res
=
pro
.
createRationalFromString
(
'
+2:-4
'
)
expect
(
result
).
assertEqual
(
-
0.5
)
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
-
0.5
)
})
})
/**
/**
...
@@ -3671,11 +3657,9 @@ describe('RationalNumberTest', function () {
...
@@ -3671,11 +3657,9 @@ describe('RationalNumberTest', function () {
*/
*/
it
(
'
test_createRationalFromStringThrowError_001
'
,
0
,
function
()
{
it
(
'
test_createRationalFromStringThrowError_001
'
,
0
,
function
()
{
try
{
try
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
123
)
pro
.
parseRationalNumber
(
1
,
2
)
var
result
=
res
.
valueOf
()
var
res
=
pro
.
createRationalFromString
(
123
)
expect
(
result
).
assertEqual
(
-
0.5
)
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
-
0.5
)
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
BusinessError: Parameter error.The type of 123 must be string
"
);
expect
(
e
.
toString
()).
assertEqual
(
"
BusinessError: Parameter error.The type of 123 must be string
"
);
}
}
...
@@ -3686,10 +3670,8 @@ describe('RationalNumberTest', function () {
...
@@ -3686,10 +3670,8 @@ describe('RationalNumberTest', function () {
* @tc.desc: Compares the current RationalNumber object with a given object.
* @tc.desc: Compares the current RationalNumber object with a given object.
*/
*/
it
(
'
test_compare_001
'
,
0
,
function
()
{
it
(
'
test_compare_001
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
pro
=
util
.
RationalNumber
.
parseRationalNumber
(
2
,
1
)
pro
.
parseRationalNumber
(
2
,
1
)
var
proc
=
util
.
RationalNumber
.
parseRationalNumber
(
3
,
4
)
var
proc
=
new
util
.
RationalNumber
()
proc
.
parseRationalNumber
(
3
,
4
)
var
res
=
pro
.
compare
(
proc
)
var
res
=
pro
.
compare
(
proc
)
expect
(
res
).
assertEqual
(
1
)
expect
(
res
).
assertEqual
(
1
)
})
})
...
@@ -3699,10 +3681,8 @@ describe('RationalNumberTest', function () {
...
@@ -3699,10 +3681,8 @@ describe('RationalNumberTest', function () {
* @tc.desc: Compares the current RationalNumber object with a given object.
* @tc.desc: Compares the current RationalNumber object with a given object.
*/
*/
it
(
'
test_compare_002
'
,
0
,
function
()
{
it
(
'
test_compare_002
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
pro
=
util
.
RationalNumber
.
parseRationalNumber
(
2
,
1
)
pro
.
parseRationalNumber
(
2
,
1
)
var
proc
=
util
.
RationalNumber
.
parseRationalNumber
(
0
,
0
)
var
proc
=
new
util
.
RationalNumber
()
proc
.
parseRationalNumber
(
0
,
0
)
var
res
=
pro
.
compare
(
proc
)
var
res
=
pro
.
compare
(
proc
)
expect
(
res
).
assertEqual
(
-
1
)
expect
(
res
).
assertEqual
(
-
1
)
})
})
...
@@ -3712,10 +3692,8 @@ describe('RationalNumberTest', function () {
...
@@ -3712,10 +3692,8 @@ describe('RationalNumberTest', function () {
* @tc.desc: Compares the current RationalNumber object with a given object.
* @tc.desc: Compares the current RationalNumber object with a given object.
*/
*/
it
(
'
test_compare_003
'
,
0
,
function
()
{
it
(
'
test_compare_003
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
pro
=
util
.
RationalNumber
.
parseRationalNumber
(
2
,
1
)
pro
.
parseRationalNumber
(
2
,
1
)
var
proc
=
util
.
RationalNumber
.
parseRationalNumber
(
8
,
3
)
var
proc
=
new
util
.
RationalNumber
()
proc
.
parseRationalNumber
(
8
,
3
)
var
res
=
pro
.
compare
(
proc
)
var
res
=
pro
.
compare
(
proc
)
expect
(
res
).
assertEqual
(
-
1
)
expect
(
res
).
assertEqual
(
-
1
)
})
})
...
@@ -3725,10 +3703,8 @@ describe('RationalNumberTest', function () {
...
@@ -3725,10 +3703,8 @@ describe('RationalNumberTest', function () {
* @tc.desc: Compares the current RationalNumber object with a given object.
* @tc.desc: Compares the current RationalNumber object with a given object.
*/
*/
it
(
'
test_compare_004
'
,
0
,
function
()
{
it
(
'
test_compare_004
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
pro
=
util
.
RationalNumber
.
parseRationalNumber
(
2
,
1
)
pro
.
parseRationalNumber
(
2
,
1
)
var
proc
=
util
.
RationalNumber
.
parseRationalNumber
(
2
,
1
)
var
proc
=
new
util
.
RationalNumber
()
proc
.
parseRationalNumber
(
2
,
1
)
var
res
=
pro
.
compare
(
proc
)
var
res
=
pro
.
compare
(
proc
)
expect
(
res
).
assertEqual
(
0
)
expect
(
res
).
assertEqual
(
0
)
})
})
...
@@ -3738,10 +3714,8 @@ describe('RationalNumberTest', function () {
...
@@ -3738,10 +3714,8 @@ describe('RationalNumberTest', function () {
* @tc.desc: Compares the current RationalNumber object with a given object.
* @tc.desc: Compares the current RationalNumber object with a given object.
*/
*/
it
(
'
test_compare_005
'
,
0
,
function
()
{
it
(
'
test_compare_005
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
pro
=
util
.
RationalNumber
.
parseRationalNumber
(
0
,
0
)
pro
.
parseRationalNumber
(
0
,
0
)
var
proc
=
util
.
RationalNumber
.
parseRationalNumber
(
2
,
1
)
var
proc
=
new
util
.
RationalNumber
()
proc
.
parseRationalNumber
(
2
,
1
)
var
res
=
pro
.
compare
(
proc
)
var
res
=
pro
.
compare
(
proc
)
expect
(
res
).
assertEqual
(
1
)
expect
(
res
).
assertEqual
(
1
)
})
})
...
@@ -3752,8 +3726,7 @@ describe('RationalNumberTest', function () {
...
@@ -3752,8 +3726,7 @@ describe('RationalNumberTest', function () {
*/
*/
it
(
'
test_compareThrowError_001
'
,
0
,
function
()
{
it
(
'
test_compareThrowError_001
'
,
0
,
function
()
{
try
{
try
{
var
pro
=
new
util
.
RationalNumber
()
var
pro
=
util
.
RationalNumber
.
parseRationalNumber
(
2
,
1
)
pro
.
parseRationalNumber
(
2
,
1
)
var
proc
=
'
str
'
var
proc
=
'
str
'
var
res
=
pro
.
compare
(
proc
)
var
res
=
pro
.
compare
(
proc
)
expect
(
res
).
assertEqual
(
1
)
expect
(
res
).
assertEqual
(
1
)
...
@@ -3767,9 +3740,7 @@ describe('RationalNumberTest', function () {
...
@@ -3767,9 +3740,7 @@ describe('RationalNumberTest', function () {
* @tc.desc: Obtains the greatest common divisor of two specified numbers.
* @tc.desc: Obtains the greatest common divisor of two specified numbers.
*/
*/
it
(
'
testgetCommonFactor001
'
,
0
,
function
()
{
it
(
'
testgetCommonFactor001
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
getCommonFactor
(
4
,
8
)
pro
.
parseRationalNumber
(
0
,
0
)
var
res
=
pro
.
getCommonFactor
(
4
,
8
)
expect
(
res
).
assertEqual
(
4
)
expect
(
res
).
assertEqual
(
4
)
})
})
...
@@ -3778,9 +3749,7 @@ describe('RationalNumberTest', function () {
...
@@ -3778,9 +3749,7 @@ describe('RationalNumberTest', function () {
* @tc.desc: Obtains the greatest common divisor of two specified numbers.
* @tc.desc: Obtains the greatest common divisor of two specified numbers.
*/
*/
it
(
'
testgetCommonFactor002
'
,
0
,
function
()
{
it
(
'
testgetCommonFactor002
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
getCommonFactor
(
10
,
15
)
pro
.
parseRationalNumber
(
0
,
0
)
var
res
=
pro
.
getCommonFactor
(
10
,
15
)
expect
(
res
).
assertEqual
(
5
)
expect
(
res
).
assertEqual
(
5
)
})
})
...
@@ -3789,9 +3758,7 @@ describe('RationalNumberTest', function () {
...
@@ -3789,9 +3758,7 @@ describe('RationalNumberTest', function () {
* @tc.desc: Obtains the greatest common divisor of two specified numbers.
* @tc.desc: Obtains the greatest common divisor of two specified numbers.
*/
*/
it
(
'
testgetCommonFactor003
'
,
0
,
function
()
{
it
(
'
testgetCommonFactor003
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
getCommonFactor
(
8
,
4
)
pro
.
parseRationalNumber
(
0
,
0
)
var
res
=
pro
.
getCommonFactor
(
8
,
4
)
expect
(
res
).
assertEqual
(
4
)
expect
(
res
).
assertEqual
(
4
)
})
})
...
@@ -3800,9 +3767,7 @@ describe('RationalNumberTest', function () {
...
@@ -3800,9 +3767,7 @@ describe('RationalNumberTest', function () {
* @tc.desc: Obtains the greatest common divisor of two specified numbers.
* @tc.desc: Obtains the greatest common divisor of two specified numbers.
*/
*/
it
(
'
testgetCommonFactor004
'
,
0
,
function
()
{
it
(
'
testgetCommonFactor004
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
getCommonFactor
(
8
,
16
)
pro
.
parseRationalNumber
(
0
,
0
)
var
res
=
pro
.
getCommonFactor
(
8
,
16
)
expect
(
res
).
assertEqual
(
8
)
expect
(
res
).
assertEqual
(
8
)
})
})
...
@@ -3811,9 +3776,7 @@ describe('RationalNumberTest', function () {
...
@@ -3811,9 +3776,7 @@ describe('RationalNumberTest', function () {
* @tc.desc: Obtains the greatest common divisor of two specified numbers.
* @tc.desc: Obtains the greatest common divisor of two specified numbers.
*/
*/
it
(
'
testgetCommonFactor005
'
,
0
,
function
()
{
it
(
'
testgetCommonFactor005
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
getCommonFactor
(
2
,
16
)
pro
.
parseRationalNumber
(
0
,
0
)
var
res
=
pro
.
getCommonFactor
(
2
,
16
)
expect
(
res
).
assertEqual
(
2
)
expect
(
res
).
assertEqual
(
2
)
})
})
...
@@ -3823,9 +3786,7 @@ describe('RationalNumberTest', function () {
...
@@ -3823,9 +3786,7 @@ describe('RationalNumberTest', function () {
*/
*/
it
(
'
testgetCommonFactorThrowError001
'
,
0
,
function
()
{
it
(
'
testgetCommonFactorThrowError001
'
,
0
,
function
()
{
try
{
try
{
var
pro
=
new
util
.
RationalNumber
()
var
res
=
util
.
RationalNumber
.
getCommonFactor
(
'
str
'
,
8
)
pro
.
parseRationalNumber
(
0
,
0
)
var
res
=
pro
.
getCommonFactor
(
'
str
'
,
8
)
expect
(
res
).
assertEqual
(
4
)
expect
(
res
).
assertEqual
(
4
)
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
BusinessError: Parameter error.The type of str must be number
"
);
expect
(
e
.
toString
()).
assertEqual
(
"
BusinessError: Parameter error.The type of str must be number
"
);
...
...
commonlibrary/ets_utils/util_lib_standard/src/main/js/test/util.test.js
浏览文件 @
510a5631
...
@@ -2397,8 +2397,7 @@ describe('RationalNumberFunTest', function () {
...
@@ -2397,8 +2397,7 @@ describe('RationalNumberFunTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_createRationalFromString_001
'
,
0
,
function
()
{
it
(
'
test_createRationalFromString_001
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
(
1
,
2
)
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
'
-1:2
'
)
var
res
=
pro
.
createRationalFromString
(
'
-1:2
'
)
var
result1
=
res
.
valueOf
()
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
-
0.5
)
expect
(
result1
).
assertEqual
(
-
0.5
)
})
})
...
@@ -2408,8 +2407,7 @@ describe('RationalNumberFunTest', function () {
...
@@ -2408,8 +2407,7 @@ describe('RationalNumberFunTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_createRationalFromString_002
'
,
0
,
function
()
{
it
(
'
test_createRationalFromString_002
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
(
1
,
2
)
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
'
+3/4
'
)
var
res
=
pro
.
createRationalFromString
(
'
+3/4
'
)
var
result1
=
res
.
valueOf
()
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
0.75
)
expect
(
result1
).
assertEqual
(
0.75
)
})
})
...
@@ -2419,8 +2417,7 @@ describe('RationalNumberFunTest', function () {
...
@@ -2419,8 +2417,7 @@ describe('RationalNumberFunTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_createRationalFromString_003
'
,
0
,
function
()
{
it
(
'
test_createRationalFromString_003
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
(
1
,
2
)
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
'
+3:-4
'
)
var
res
=
pro
.
createRationalFromString
(
'
+3:-4
'
)
var
result1
=
res
.
valueOf
()
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
-
0.75
)
expect
(
result1
).
assertEqual
(
-
0.75
)
})
})
...
@@ -2430,8 +2427,7 @@ describe('RationalNumberFunTest', function () {
...
@@ -2430,8 +2427,7 @@ describe('RationalNumberFunTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_createRationalFromString_004
'
,
0
,
function
()
{
it
(
'
test_createRationalFromString_004
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
(
1
,
2
)
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
'
+2:4
'
)
var
res
=
pro
.
createRationalFromString
(
'
+2:4
'
)
var
result1
=
res
.
valueOf
()
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
0.5
)
expect
(
result1
).
assertEqual
(
0.5
)
})
})
...
@@ -2441,8 +2437,7 @@ describe('RationalNumberFunTest', function () {
...
@@ -2441,8 +2437,7 @@ describe('RationalNumberFunTest', function () {
* @tc.desc: Creates a RationalNumber object based on a given string.
* @tc.desc: Creates a RationalNumber object based on a given string.
*/
*/
it
(
'
test_createRationalFromString_005
'
,
0
,
function
()
{
it
(
'
test_createRationalFromString_005
'
,
0
,
function
()
{
var
pro
=
new
util
.
RationalNumber
(
1
,
2
)
var
res
=
util
.
RationalNumber
.
createRationalFromString
(
'
-2:-4
'
)
var
res
=
pro
.
createRationalFromString
(
'
-2:-4
'
)
var
result1
=
res
.
valueOf
()
var
result1
=
res
.
valueOf
()
expect
(
result1
).
assertEqual
(
0.5
)
expect
(
result1
).
assertEqual
(
0.5
)
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录