From: Marius Gavrilescu Date: Sat, 10 Feb 2018 18:25:37 +0000 (+0000) Subject: Extra test X-Git-Tag: 0.001001~3 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=f71b3492033e1a24fe2d84731a3f09d1dba911b1;p=app-scheme79asm.git Extra test --- diff --git a/t/App-Scheme79asm.t b/t/App-Scheme79asm.t index d95980b..7da1c05 100644 --- a/t/App-Scheme79asm.t +++ b/t/App-Scheme79asm.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 3; BEGIN { use_ok('App::Scheme79asm') }; sub run_test { @@ -15,12 +15,26 @@ sub run_test { is $actual, $expected, $name } -run_test {addr_bits => 5}, '(quoted . (symbol . 5))', <<'', '(QUOTE 5)'; -mem[0] <= 0; -mem[1] <= 0; -mem[2] <= 8'b00100000; -mem[3] <= 8'b00100000; -mem[4] <= 8'd8; -mem[5] <= 8'b11100111; -mem[6] <= 0; -mem[7] <= 8'b00100101; +run_test {addr_bits => 5}, '(quoted (symbol 5))', <<'', '(QUOTE 5)'; +mem[0] <= 0; // (cdr part of NIL) +mem[1] <= 0; // (car part of NIL) +mem[2] <= 8'b00100000; // (cdr part of T) +mem[3] <= 8'b00100000; // (car part of T) +mem[4] <= 8'd8; // (free storage pointer) +mem[5] <= 8'b11100111; // QUOTED 7 +mem[6] <= 0; // (result of computation) +mem[7] <= 8'b00100101; // SYMBOL 5 + +run_test {addr_bits => 13}, '(call (more (funcall nil) (proc (var -2))) (number 5))', <<'', '((LAMBDA ID (X) X) 5)'; +mem[ 0] <= 0; // (cdr part of NIL) +mem[ 1] <= 0; // (car part of NIL) +mem[ 2] <= 16'b0010000000000000; // (cdr part of T) +mem[ 3] <= 16'b0010000000000000; // (car part of T) +mem[ 4] <= 16'd12; // (free storage pointer) +mem[ 5] <= 16'b1100000000000111; // CALL 7 +mem[ 6] <= 0; // (result of computation) +mem[ 7] <= 16'b0000000000001001; // MORE 9 +mem[ 8] <= 16'b0010000000000101; // NUMBER 5 +mem[ 9] <= 16'b1110000000000000; // FUNCALL NIL +mem[10] <= 16'b1000000000001011; // PROC 11 +mem[11] <= 16'b0011111111111110; // VAR -2