Pārlūkot izejas kodu

Testing the ability to trigger events for PDA and PDB as well as DD* masking.

master
Bryan Miller pirms 5 gadiem
vecāks
revīzija
d667ca6ad6
1 mainītis faili ar 35 papildinājumiem un 1 dzēšanām
  1. +35
    -1
      test/unit.src.MOSCIA.spec.js

+ 35
- 1
test/unit.src.MOSCIA.spec.js Parādīt failu

@@ -3,9 +3,43 @@ const MOSCIA = require('../src/MOSCIA.js');


describe("MOSCIA Tests...", function(){
var cia = new MOSCIA();
//var cia = new MOSCIA();

it("PD*/DD* Masking", function(){
let cia = new MOSCIA();
let pdaVal = 0x3C;
let pdbVal = 0xC3;
cia.onRead("PDA", (name, dda) => {
if (dda < 255)
cia.setPDA(pdaVal);
});
cia.onRead("PDB", (name, ddb) => {
if (ddb < 255)
cia.setPDB(pdbVal);
});

cia.RS = 0x02;
cia.DATA = 0x00;
cia.RS = 0x00;
expect(cia.DATA).to.be.equal(pdaVal);
cia.RS = 0x03;
cia.DATA = 0x00;
cia.RS = 0x01;
expect(cia.DATA).to.be.equal(pdbVal);
cia.RS = 0x02;
cia.DATA = pdbVal;
cia.RS = 0x00;
cia.DATA = pdbVal;
expect(cia.DATA).to.be.equal(0xFF);
cia.RS = 0x03;
cia.DATA = pdaVal;
cia.RS = 0x01;
cia.DATA = pdaVal;
expect(cia.DATA).to.be.equal(0xFF);
});

it("Serial IO", function(){
let cia = new MOSCIA();
let Input = (i) => {
cia.SP = i;
cia.CNT = 1;

Notiek ielāde…
Atcelt
Saglabāt