-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiles and also removing lint from test for now
- Loading branch information
Showing
7 changed files
with
124 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
|
||
function _waitForStart(mod) { | ||
return new Promise((resolve, reject)=>{ | ||
mod.addOnPostRun(resolve); | ||
}); | ||
} | ||
|
||
module.exports = () => { | ||
// let state = 0; // idle | ||
// let total = 0; | ||
// let start = 0; | ||
|
||
const wasm = require('../out/vcd.js'); | ||
|
||
|
||
let start = async() => { | ||
await _waitForStart(wasm); | ||
} | ||
|
||
return { | ||
start, | ||
log: () => { | ||
console.log(wasm); | ||
}, | ||
onB: (time, cmd) => { | ||
|
||
}, | ||
onNotB: (time, cmd) => { | ||
switch(state) { | ||
case 0: if (cmd === 14) { state = 2; } break; | ||
case 1: if (cmd === 14) { state = 3; start = time; } break; | ||
case 2: if (cmd === 15) { state = 0; } break; | ||
case 3: if (cmd === 15) { state = 1; total += (time - start); start = 0; } break; | ||
default: throw new Error(); | ||
} | ||
}, | ||
time: () => total + start | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
const expect = require('chai').expect; | ||
// const lib = require('../lib/index.js'); | ||
|
||
const dut = require('../lib/index.js'); | ||
|
||
|
||
describe('basic', () => { | ||
|
||
let wrapper; | ||
|
||
// return a promise from before and mocha | ||
// will wait for it | ||
before(() => { | ||
wrapper = dut.wrapper(); | ||
return wrapper.start(); | ||
}); | ||
|
||
|
||
it('wasm basic', done => { | ||
|
||
console.log("test"); | ||
|
||
// console.log(wrapper.log()); | ||
|
||
|
||
// expect(lib.parser).to.be.an('function'); | ||
done(); | ||
}); | ||
|
||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters