Sha256: 2c9d475adf6570ff9a01fdffd0587c248fd55fde9f726d5268d073edd6b19b12

Contents?: true

Size: 586 Bytes

Versions: 2

Compression:

Stored size: 586 Bytes

Contents

require 'test_helper'

class AInstructionTest < Minitest::Test
  def test_that_it_converts_zero
    bytecode = AInstruction.translate('@0')
    assert_equal '0000000000000000', bytecode
  end

  def test_that_it_converts_a_positive_value
    bytecode = AInstruction.translate('@4')
    assert_equal '0000000000000100', bytecode
  end

  def test_that_it_raises_parser_error_on_symbol
    assert_raises(ParserError) { AInstruction.translate('@ERR') }
  end

  def test_that_it_raises_parser_error_on_missing_value
    assert_raises(ParserError) { AInstruction.translate('@') }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hack_assembler-0.2.0 test/a_instruction_test.rb
hack_assembler-0.1.0 test/a_instruction_test.rb