Sha256: a1deba40fbb1a881a5375428441769e531b41ef150ac5462588596a910547756

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

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

require "sixarm_ruby_geometry/indexable/xy"
require "sixarm_ruby_geometry_test/fake"

module Indexable
  class XYTest < Minitest::Test

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

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

    def test_x
      x = fake_n
      o = C[x,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]
      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

    protected

    def fake_indexable
      C[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/xy_test.rb
sixarm_ruby_geometry-3.0.0 test/sixarm_ruby_geometry_test/indexable/xy_test.rb