瀏覽代碼

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

master
Bryan Miller 5 年之前
父節點
當前提交
d667ca6ad6
共有 1 個檔案被更改,包括 35 行新增1 行删除
  1. +35
    -1
      test/unit.src.MOSCIA.spec.js

+ 35
- 1
test/unit.src.MOSCIA.spec.js 查看文件

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

Loading…
取消
儲存