Sha256: 9fba94b3486b67379c65066644a1eef90cedcaf3cce7ac90cea8fa06e74954e7

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'test/unit'

require 'rockit/assembler/llvm/instructions'
include Rockit::Assembler::LLVM

class UTestLLVMInstructions < Test::Unit::TestCase
  def test_01_NamedValue_valid
    nv1 = NamedValue.new("foo")
    assert_equal("%foo", nv1.to_llvm)

    nv2 = NamedValue.new("DivByZero")
    assert_equal("%DivByZero", nv2.to_llvm)

    nv3 = NamedValue.new("a.really.long.identifier")
    assert_equal("%a.really.long.identifier", nv3.to_llvm)
  end

  def test_02_NamedValue_invalid
    assert_raises(ArgumentError) {NamedValue.new("12")}
    assert_raises(ArgumentError) {NamedValue.new("%")}
  end

  def test_03_UnnamedValue_valid
    u1 = UnnamedValue.new(0)
    assert_equal("%0", u1.to_llvm)

    u2 = UnnamedValue.new(12)
    assert_equal("%12", u2.to_llvm)

    u3 = UnnamedValue.new(2)
    assert_equal("%2", u3.to_llvm)

    u4 = UnnamedValue.new(44)
    assert_equal("%44", u4.to_llvm)
  end

  def test_04_UnnamedValue_invalid
    assert_raises(ArgumentError) {UnnamedValue.new(-1)}
    assert_raises(ArgumentError) {UnnamedValue.new(-18743)}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rockit-0.7.1 tests/unit/rockit/assembler/llvm/utest_instructions.rb