lox-d/test/all.d

21 lines
387 B
D
Executable file

#!/bin/env rdmd
import std.process;
import std.conv;
void main(){
string fib(uint n){
string r = "";
double a = 0;
double temp;
for(double b = 1; a <= n; b = temp + b){
r ~= a.to!string ~ "\n";
temp = a;
a = b;
}
return r;
}
assert([ "./lox", "test/fib21.lox" ].execute.output == fib(6765));
assert([ "./lox", "test/fib10.lox" ].execute.output == fib(34));
}