Skip to content

Commit

Permalink
Add a test for the fix for #439, and start on #204
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgodbolt committed Sep 11, 2024
1 parent 0146042 commit ec43caa
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions tests/integration/via.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import * as utils from "../../utils.js";
import { describe, it } from "mocha";
import { TestMachine } from "./test-machine.js";
import assert from "assert";

async function runViaProgram(source) {
const testMachine = new TestMachine();
await testMachine.initialise();
await testMachine.runUntilInput();
await testMachine.loadBasic(source);

testMachine.captureText((elem) => console.log(`emulator output: ${elem.text}`));
await testMachine.type("RUN");
await testMachine.runUntilInput();
return testMachine;
}

describe("should pass scarybeasts' VIA tests", function () {
// Code here extracted and paraphrased from the SSD zipfile from https://github.com/mattgodbolt/jsbeeb/issues/179
it("VIA.AC1 - Does ACR write restart timer?", async function () {
// REM REAL BBC! 64, 0, 0, 128
// REM JSBEEB: 64, 0, 0, 128
const source = `
// Real BBC: 64, 0, 0, 128
const testMachine = await runViaProgram(`
DIM MC% 100
R% = &200
P% = MC%
Expand Down Expand Up @@ -51,15 +61,7 @@ PRINT "REAL BBC: 64, 0, 0, 128"
PRINT ?(R%)
PRINT ?(R%+1)
PRINT ?(R%+2)
PRINT ?(R%+3)`;
const testMachine = new TestMachine();
await testMachine.initialise();
await testMachine.runUntilInput();
await testMachine.loadBasic(source);

testMachine.captureText((elem) => console.log(`emulator output: ${elem.text}`));
await testMachine.type("RUN");
await testMachine.runUntilInput();
PRINT ?(R%+3)`);
assert.equal(testMachine.readbyte(0x200), 64);
assert.equal(testMachine.readbyte(0x201), 0);
assert.equal(testMachine.readbyte(0x202), 0);
Expand Down

0 comments on commit ec43caa

Please sign in to comment.