File: ruby-tests.rb

package info (click to toggle)
ruby-gd 0.8.0-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 740 kB
  • sloc: ansic: 2,177; ruby: 226; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'GD'
require 'test/unit'

class GDTest < Test::Unit::TestCase

  attr_reader :p

  def setup
    @p = GD::Polygon.new
    p.addPt(1,1)
    p.addPt(1,2)
    p.addPt(2,1)
    p.addPt(2,2)
  end

  def test_polygon_length
    assert_equal 4, p.length
  end

  def test_polygon_bounds
    assert_equal [1,1,2,2], p.bounds
  end

  def test_polygon_vertices
    assert_equal [[1,1],[1,2],[2,1], [2,2]], p.vertices
  end

end