Sha256: 8d2e5c96b24f8db8e000f21ba5da21fb16e2a146eb81c4c61858d168125663fb

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require 'minitest_helper'

class TestMatrix < TestInterpreterBase
  def setup

  end

  def test_integer
    assert_iq_equal(
      '(1 2 3; 4 5 6)',
      '(1 2 3; 4 5 6)'
    )

    assert_iq_equal(
      '(1 2 3; 4 5 6) + (1 2 3; 4 5 6)',
      '(2 4 6; 8 10 12)'
    )

    assert_iq_equal(
      '(1 2 3; 4 5 6) - (2 4 1; 8 3 9)',
      '(-1 -2 2; -4 2 -3)'
    )

    assert_iq_equal(
      '(1 2; 3 4) * (1 2; 3 4)',
      '(7 10; 15 22)'
    )

    assert_iq_equal(
      '(1 2; 3 4) ** 2',
      '(7 10; 15 22)'
    )

    assert_iq_equal(
      '(1 2; 3 4) ** 2',
      '(7 10; 15 22)'
    )

    assert_iq_equal(
      '(1 2; 3 4) * (1 2)',
      '(5 11)'
    )

    assert_iq_equal(
      '(1 2 3; 4 5 6)t',
      '(1 4; 2 5; 3 6)'
    )

    assert_iq_equal(
      '(1 2 3
        4 5 6) +
       (1 2 3
        4 5 6)',
      '(2 4 6; 8 10 12)'
    )
  end

  def test_float
    assert_iq_equal(
      '(1.0  2.0  3
        4.2  5.3  6)t',
      '(1.0 4.2; 2.0 5.3; 3 6)'
    )

    assert_iq_equal(
      '(1.0  2.0  3
        4.2  5.3  6)t',
      '(1.0 4.2; 2.0 5.3; 3 6)'
    )
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
qlang-0.0.27182123 test/interpreter/test_matrix.rb
qlang-0.0.27182122 test/interpreter/test_matrix.rb
qlang-0.0.27182121 test/interpreter/test_matrix.rb
qlang-0.0.27182120 test/interpreter/test_matrix.rb
qlang-0.0.27182110 test/interpreter/test_matrix.rb
qlang-0.0.27182100 test/interpreter/test_matrix.rb