浏览代码

Clock test improved to allow for a +/-1% variation in cycles.

master
Bryan Miller 5 年前
父节点
当前提交
124d9d4ff3
共有 1 个文件被更改,包括 10 次插入4 次删除
  1. +10
    -4
      test/unit.src.common.clock.spec.js

+ 10
- 4
test/unit.src.common.clock.spec.js 查看文件

}); });


it("4Khz for approx. 1 second", function(){ it("4Khz for approx. 1 second", function(){
let dt = speedTest(4000);
expect(count).to.be.lt(4004);
let ts = 4000;
let d = ts * 0.01;
let dt = speedTest(ts);
expect(count).to.be.gt(ts - d);
expect(count).to.be.lt(ts + d);
expect(dt).to.be.lt(1000); expect(dt).to.be.lt(1000);
}); });


it("4Mhz for approx. 1 second", function(){ it("4Mhz for approx. 1 second", function(){
let dt = speedTest(4000000);
expect(count).to.be.lt(4000004);
let ts = 4000000;
let d = ts * 0.01;
let dt = speedTest(ts);
expect(count).to.be.gt(ts - d);
expect(count).to.be.lt(ts + d);
expect(dt).to.be.lt(1000); expect(dt).to.be.lt(1000);
}); });
}); });

正在加载...
取消
保存