Sha256: 6a0d2354efbbf40d425f15cc81bb4c8c375c4a5d04426fe7f1f418a30a503c30

Contents?: true

Size: 513 Bytes

Versions: 3

Compression:

Stored size: 513 Bytes

Contents

require 'helper'

class TestVM < Test::Unit::TestCase
  
  PROGRAMS = File.readlines(File.join(File.dirname(__FILE__), "test_vm"))
  RESULT = File.readlines(File.join(File.dirname(__FILE__), "test_vm_result"))
  
  context "The VM" do
    
    PROGRAMS.each_with_index do |program, i|
      vm = PLang::VM::Interpreter.new(PLang::Parser::SyntaxAnalyser.new(program).parse)
      should "interp the expression ##{i}" do
        assert_equal vm.execute!.params[0], eval(RESULT[i])
      end
    end
  
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
p-lang-0.3.1 test/test_vm.rb
p-lang-0.3.0 test/test_vm.rb
p-lang-0.2.0 test/test_vm.rb