Sha256: 326b2bd4545f227cb1a62291fe0e3717e43068707c1441f19fb72166aef55c15

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

# -*- coding: utf-8 -*-
require "minitest/autorun"
require "simplecov"
SimpleCov.start

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

2 entries across 2 versions & 1 rubygems

Version Path
sixarm_ruby_geometry-3.1.1 test/sixarm_ruby_geometry_test/indexable/xyz_test.rb
sixarm_ruby_geometry-3.0.0 test/sixarm_ruby_geometry_test/indexable/xyz_test.rb