Pārlūkot izejas kodu

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

master
Bryan Miller pirms 5 gadiem
vecāks
revīzija
124d9d4ff3
1 mainītis faili ar 10 papildinājumiem un 4 dzēšanām
  1. +10
    -4
      test/unit.src.common.clock.spec.js

+ 10
- 4
test/unit.src.common.clock.spec.js Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt