2016-12-10 03:01:47 +01:00
|
|
|
require_relative "helper"
|
|
|
|
|
2017-01-19 08:02:29 +01:00
|
|
|
module Risc
|
2016-12-10 03:01:47 +01:00
|
|
|
|
2017-01-03 21:37:25 +01:00
|
|
|
class TestBasic < MiniTest::Test
|
|
|
|
include ExpressionHelper
|
|
|
|
include AST::Sexp
|
2016-12-10 03:01:47 +01:00
|
|
|
|
2017-01-03 21:37:25 +01:00
|
|
|
def setup
|
2017-01-19 08:02:29 +01:00
|
|
|
Risc.machine.boot
|
|
|
|
@output = Risc::RiscValue
|
2017-01-03 21:37:25 +01:00
|
|
|
end
|
2016-12-10 03:01:47 +01:00
|
|
|
|
2017-01-03 21:37:25 +01:00
|
|
|
def test_number
|
|
|
|
@input = s(:int , 42)
|
|
|
|
assert_equal 42 , check.value
|
|
|
|
end
|
2016-12-10 03:01:47 +01:00
|
|
|
|
2017-01-03 21:37:25 +01:00
|
|
|
def test_true
|
|
|
|
@input = s(:true)
|
|
|
|
check
|
|
|
|
end
|
|
|
|
def test_false
|
|
|
|
@input = s(:false)
|
|
|
|
check
|
|
|
|
end
|
|
|
|
def test_nil
|
|
|
|
@input = s(:nil)
|
|
|
|
check
|
|
|
|
end
|
|
|
|
def test_self
|
2017-01-16 08:34:47 +01:00
|
|
|
@input = s(:known, :self)
|
2017-01-03 21:37:25 +01:00
|
|
|
check
|
|
|
|
end
|
|
|
|
def test_string
|
|
|
|
@input = s(:string , "hello")
|
|
|
|
check
|
|
|
|
end
|
2016-12-10 03:01:47 +01:00
|
|
|
|
2017-01-03 21:37:25 +01:00
|
|
|
end
|
2016-12-10 03:01:47 +01:00
|
|
|
end
|