diff --git a/test/all.d b/test/all.d new file mode 100755 index 0000000..14ca0b7 --- /dev/null +++ b/test/all.d @@ -0,0 +1,20 @@ +#!/bin/env rdmd + +import std.process; +import std.conv; + +void main(){ + string fib21(){ + string r = ""; + double a = 0; + double temp; + for(double b = 1; a < 10000; b = temp + b){ + r ~= a.to!string ~ "\n"; + temp = a; + a = b; + } + return r; + } + assert([ "./lox", "test/fib21.lox" ].execute.output == fib21()); +} + diff --git a/test/fib21.lox b/test/fib21.lox new file mode 100644 index 0000000..534d25e --- /dev/null +++ b/test/fib21.lox @@ -0,0 +1,10 @@ + +var a = 0; +var temp; + +for(var b = 1; a < 10000; b = temp + b){ + print a; + temp = a; + a = b; +} +