2015-11-18 12:04:57 +01:00
|
|
|
require_relative '../helper'
|
2015-11-07 16:37:41 +01:00
|
|
|
|
2015-11-18 12:04:57 +01:00
|
|
|
# Parfait test test just that, parfait.
|
|
|
|
#
|
|
|
|
# The idea is to have really really small main programs that test one very small thing
|
|
|
|
# AND return an exit code (or write stdout) that can be checked by
|
|
|
|
# compiling and running the thing remotely
|
|
|
|
#
|
|
|
|
module ParfaitTests
|
|
|
|
include RuntimeTests
|
2015-11-07 16:37:41 +01:00
|
|
|
|
|
|
|
def setup
|
|
|
|
@stdout = ""
|
2017-01-19 08:02:29 +01:00
|
|
|
@machine = Risc.machine.boot
|
2017-01-14 18:28:44 +01:00
|
|
|
Vm::Compiler.load_parfait
|
2015-11-07 16:37:41 +01:00
|
|
|
end
|
2015-11-18 12:04:57 +01:00
|
|
|
|
2015-11-07 16:37:41 +01:00
|
|
|
def main
|
2015-11-18 12:04:57 +01:00
|
|
|
runko = <<HERE
|
2015-11-30 15:09:12 +01:00
|
|
|
class Space < Object
|
2015-11-07 16:37:41 +01:00
|
|
|
int main()
|
|
|
|
PROGRAM
|
|
|
|
end
|
|
|
|
end
|
|
|
|
HERE
|
2015-11-18 12:04:57 +01:00
|
|
|
runko.sub("PROGRAM" , @main )
|
2015-11-07 16:37:41 +01:00
|
|
|
end
|
|
|
|
end
|