Ver código fonte

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

master
Bryan Miller 5 anos atrás
pai
commit
124d9d4ff3
1 arquivos alterados com 10 adições e 4 exclusões
  1. +10
    -4
      test/unit.src.common.clock.spec.js

+ 10
- 4
test/unit.src.common.clock.spec.js Ver arquivo

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

Carregando…
Cancelar
Salvar