From 735264de8452e92eb6d3c63f30689ef03feed3ed Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 2 Nov 2015 11:51:23 -0500 Subject: [PATCH 1/3] Make metadata optional. Most tests now pass. Starts fixing #9 --- Gruntfile.js | 2 +- bsim/assemble.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 4e80c19..e3d3dd3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -142,7 +142,7 @@ module.exports = function(grunt) { grunt.registerTask('workbook', ['bsim_workbook','tmsim_workbook']); grunt.registerTask('edx', ['bsim_edx','tmsim_edx']); - //grunt.registerTask('test', ['connect', 'qunit:all']) + grunt.registerTask('test', ['connect', 'qunit:all']) // Builds everything if just called as 'grunt' grunt.registerTask('default', ['bsim','jsim','tmsim']); diff --git a/bsim/assemble.js b/bsim/assemble.js index a70971d..23b9634 100644 --- a/bsim/assemble.js +++ b/bsim/assemble.js @@ -1116,6 +1116,12 @@ //var can_succeed = true; var errors = []; + // metadata is optional + if(callback === undefined) { + callback = metadata; + metadata = null; + } + sources = []; // initialize list of sources parse_file(file, content, function(syntax) { var code; From 5e691be2d5cf3860b824f2eea743bfc3e7c50929 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 2 Nov 2015 12:26:23 -0500 Subject: [PATCH 2/3] Make editor optional. Include tests now pass --- bsim/assemble.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bsim/assemble.js b/bsim/assemble.js index 23b9634..92f1423 100644 --- a/bsim/assemble.js +++ b/bsim/assemble.js @@ -807,6 +807,13 @@ var mParsedFiles = {}; var mPendingIncludes = []; + // allow an assembler to be constructed independantly of an editor + if (editor === undefined) { + editor = { + getFile: function() { return FileSystem.getFile.apply(FileSystem, arguments); } + } + } + // Parses a macro definition var parse_macro = function(stream) { var macro_name = readSymbol(stream); From 9eba6613e9c294b38db53767d5679c38f58f106a Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 2 Nov 2015 20:43:26 -0500 Subject: [PATCH 3/3] Fix checksums in verifier tests --- bsim/tests/assemble.js | 2 +- bsim/tests/verifier.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bsim/tests/assemble.js b/bsim/tests/assemble.js index 2b51445..f748e12 100644 --- a/bsim/tests/assemble.js +++ b/bsim/tests/assemble.js @@ -685,6 +685,6 @@ test(".pcheckoff works", function() { }); assembler.assemble("t.uasm", '.pcheckoff "some url" "some name" 42\n.verify 0x20 8 0x73657420 0x2e2e2e74 0xa 0x20000000 0x73ff0143 0xc15f04e0 0x42ff04e1 0xd2370056', function(success, result) { - equal(result.checkoff.running_checksum, -2102874770, "Negative checksum is calculated correctly."); + equal(result.checkoff.running_checksum, -2102874768, "Negative checksum is calculated correctly."); }); }); diff --git a/bsim/tests/verifier.js b/bsim/tests/verifier.js index eb309f5..53ec814 100644 --- a/bsim/tests/verifier.js +++ b/bsim/tests/verifier.js @@ -3,7 +3,7 @@ module("Verifiers"); test("TextVerifier", function() { var beta = new FakeBeta(); - var verifier = new BSim.TextVerifier(beta, {checksum: -318887899}); + var verifier = new BSim.TextVerifier(beta, {checksum: -318887901}); ok(!verifier.verify(), "Verification fails on un-run beta."); ok(/no simulation results/i.test(verifier.getMessage()), "Failed with no simulation results message."); beta.setCycleCount(1);