Sha256: 8cc83989085f7fce67bd3c25d61c9cd65ffbe79d69216b3b644d4c56c5417589

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

# -*- coding: utf-8 -*-
require "sixarm_ruby_geometry_test"
require "sixarm_ruby_geometry/indexable/xyz"
require "sixarm_ruby_geometry_test/fake"

module Indexable
  class XYZTest < Minitest::Test

    def test_0
      assert(::Indexable::XYZ)
    end

    require "matrix"
    class C < Vector
      include ::Indexable::XYZ
    end

    def test_new
      assert(C[0,0,0])
    end

    def test_x
      x = fake_n
      o = C[x, 0, 0]
      assert_equal(x, o.x)
    end

    def test_x_equal
      x = fake_n
      o = fake_indexable
      refute_equal(x, o.x)
      o.x = x
      assert_equal(x, o.x)
    end

    def test_y
      y = fake_n
      o = C[0, y, 0]
      assert_equal(y, o.y)
    end

    def test_y_equal
      y = fake_n
      o = fake_indexable
      refute_equal(y, o.y)
      o.y = y
      assert_equal(y, o.y)
    end

    def test_z
      z = fake_n
      o = C[0, 0, z]
      assert_equal(z, o.z)
    end

    def test_z_equal
      z = fake_n
      o = fake_indexable
      refute_equal(z, o.z)
      o.z = z
      assert_equal(z, o.z)
    end

    def fake_indexable
      C[0, 0, 0]
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sixarm_ruby_geometry-4.0.0 test/sixarm_ruby_geometry_test/indexable/xyz_test.rb