提交 fe85264f 编写于 作者: S shikai-123
上级 4606594e
...@@ -1323,9 +1323,13 @@ describe('ChildProcessTest', function () { ...@@ -1323,9 +1323,13 @@ describe('ChildProcessTest', function () {
function sleep(d){ function sleep(d){
while(process.uptime() - result1 <= d); while(process.uptime() - result1 <= d);
} }
sleep(5); sleep(6);
let result2 = process.uptime() - 6 let result2 = process.uptime()
expect(result1).assertEqual(result2) if ((result2 - result1) >= 6)
{
let flag = true
}
expect(flag).assertEqual(true)
}) })
/** /**
...@@ -1335,13 +1339,17 @@ describe('ChildProcessTest', function () { ...@@ -1335,13 +1339,17 @@ describe('ChildProcessTest', function () {
* @tc.author: wangben * @tc.author: wangben
*/ */
it('testUptime002', 0, function () { it('testUptime002', 0, function () {
var result1 = process.uptime() let result1 = process.uptime()
function sleep(d){ function sleep(d){
while(process.uptime() - result1 <= d); while(process.uptime() - result1 <= d);
} }
sleep(8); sleep(8);
let result2 = process.uptime() - 9 let result2 = process.uptime()
expect(result1).assertEqual(result2) if ((result2 - result1) >= 8)
{
let flag = true
}
expect(flag).assertEqual(true)
}) })
/** /**
...@@ -1356,8 +1364,12 @@ describe('ChildProcessTest', function () { ...@@ -1356,8 +1364,12 @@ describe('ChildProcessTest', function () {
while(process.uptime() - result1 <= d); while(process.uptime() - result1 <= d);
} }
sleep(10); sleep(10);
let result2 = process.uptime() - 11 let result2 = process.uptime()
expect(result1).assertEqual(result2) if ((result2 - result1) >= 10)
{
let flag = true
}
expect(flag).assertEqual(true)
}) })
/** /**
...@@ -1372,8 +1384,12 @@ describe('ChildProcessTest', function () { ...@@ -1372,8 +1384,12 @@ describe('ChildProcessTest', function () {
while(process.uptime() - result1 <= d); while(process.uptime() - result1 <= d);
} }
sleep(7); sleep(7);
let result2 = process.uptime() - 8 let result2 = process.uptime()
expect(result1).assertEqual(result2) if ((result2 - result1) >= 7)
{
let flag = true
}
expect(flag).assertEqual(true)
}) })
/** /**
...@@ -1383,13 +1399,17 @@ describe('ChildProcessTest', function () { ...@@ -1383,13 +1399,17 @@ describe('ChildProcessTest', function () {
* @tc.author: wangben * @tc.author: wangben
*/ */
it('testUptime005', 0, function () { it('testUptime005', 0, function () {
var result1 = process.uptime() let result1 = process.uptime()
function sleep(d){ function sleep(d){
while(process.uptime() - result1 <= d); while(process.uptime() - result1 <= d);
} }
sleep(11); sleep(11);
var result2 = process.uptime() - 12 let result2 = process.uptime()
expect(result1).assertEqual(result2) if ((result2 - result1) >= 11)
{
let flag = true
}
expect(flag).assertEqual(true)
}) })
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册