瀏覽代碼

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 查看文件

@@ -25,14 +25,20 @@ describe("Clock Tests", 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);
});

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);
});
});

Loading…
取消
儲存