Sha256: f37b631bd3bc7f860707aa99cc68eef47c127226f26b756e02cd4d153bafa4c9

Contents?: true

Size: 1.31 KB

Versions: 38

Compression:

Stored size: 1.31 KB

Contents

require 'test/unit'

require 'fox16'

include Fox

class TC_FXPoint < Test::Unit::TestCase
  def setup
    @point1 = FXPoint.new
    @point2 = FXPoint.new(300, 200)
    @point3 = FXPoint.new(FXSize.new(300, 200))
  end

  def test_copy
    assert_equal(@point1, FXPoint.new(@point1))
    assert_equal(@point2, FXPoint.new(@point2))
  end

  # The assertEqual() method will test the implementation of
  # FXPoint's '==' method, which is the point of this test
  def test_equals
    assert_equal(@point2, @point3)
  
    samePoint1 = FXPoint.new
    samePoint1.x = @point1.x
    samePoint1.y = @point1.y
    assert_equal(@point1, samePoint1)
    assert_equal(samePoint1, @point1)

    samePoint2 = FXPoint.new(300, 200)
    assert_equal(@point2, samePoint2)
    assert_equal(samePoint2, @point2)
  end

  def test_uminus
    point1 = -(@point1)
    assert(point1.x == -(@point1.x) && point1.y == -(@point1.y))
    point2 = -(@point2)
    assert(point2.x == -(@point2.x) && point2.y == -(@point2.y))
  end

  def test_add
    assert(FXPoint.new(1, 2) + FXPoint.new(3, 4) == FXPoint.new(4, 6))
  end

  def test_sub
    assert(FXPoint.new(4, 6) - FXPoint.new(3, 4) == FXPoint.new(1, 2))
  end

  def test_mul
    assert(FXPoint.new(1, 2)*3 == FXPoint.new(3, 6))
  end

  def test_div
    assert(FXPoint.new(3, 6)/3 == FXPoint.new(1, 2))
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
fxruby-1.6.20-x86-mingw32 test/TC_FXPoint.rb
fxruby-1.6.20-x86-linux test/TC_FXPoint.rb
fxruby-1.6.20 test/TC_FXPoint.rb
fxruby-1.6.20-universal-darwin-10 test/TC_FXPoint.rb
fxruby-1.6.19-x86-mingw32 tests/TC_FXPoint.rb
fxruby-1.6.14-mswin32 tests/TC_FXPoint.rb
fxruby-1.6.13-mswin32 tests/TC_FXPoint.rb
fxruby-1.6.0 tests/TC_FXPoint.rb
fxruby-1.6.1 tests/TC_FXPoint.rb
fxruby-1.6.11 tests/TC_FXPoint.rb
fxruby-1.6.10 tests/TC_FXPoint.rb
fxruby-1.6.12 tests/TC_FXPoint.rb
fxruby-1.6.13 tests/TC_FXPoint.rb
fxruby-1.6.14-universal-darwin-9 tests/TC_FXPoint.rb
fxruby-1.6.15-universal-darwin-9 tests/TC_FXPoint.rb
fxruby-1.6.14 tests/TC_FXPoint.rb
fxruby-1.6.15 tests/TC_FXPoint.rb
fxruby-1.6.15-x86-mswin32-60 tests/TC_FXPoint.rb
fxruby-1.6.16-universal-darwin-9 tests/TC_FXPoint.rb
fxruby-1.6.16-x86-mswin32-60 tests/TC_FXPoint.rb