Class: GeometryTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/test/geometry_test.rb

Instance Method Summary collapse

Instance Method Details

#test_should_resizeObject



5
6
7
8
9
10
# File 'lib/test/geometry_test.rb', line 5

def test_should_resize
  assert_geometry 50, 64,
    "50x50"   => [39, 50],
    "60x60"   => [47, 60],
    "100x100" => [78, 100]
end

#test_should_resize_no_heightObject



19
20
21
22
23
24
# File 'lib/test/geometry_test.rb', line 19

def test_should_resize_no_height
  assert_geometry 50, 64,
    "50"  => [50, 64],
    "60"  => [60, 77],
    "100" => [100, 128]
end

#test_should_resize_no_widthObject



12
13
14
15
16
17
# File 'lib/test/geometry_test.rb', line 12

def test_should_resize_no_width
  assert_geometry 50, 64,
    "x50"  => [39, 50],
    "x60"  => [47, 60],
    "x100" => [78, 100]
end

#test_should_resize_with_greaterObject



70
71
72
73
74
75
76
77
# File 'lib/test/geometry_test.rb', line 70

def test_should_resize_with_greater
  assert_geometry 50, 64,
    "50x50>"   => [39, 50],
    "60x60>"   => [47, 60],
    "100x100>" => [50, 64],
    "100x112>" => [50, 64],
    "40x70>"   => [40, 51]
end

#test_should_resize_with_greater_and_no_heightObject



86
87
88
89
90
91
# File 'lib/test/geometry_test.rb', line 86

def test_should_resize_with_greater_and_no_height
  assert_geometry 50, 64,
    "40>"  => [40, 51],
    "60>"  => [50, 64],
    "100>" => [50, 64]
end

#test_should_resize_with_greater_and_no_widthObject



79
80
81
82
83
84
# File 'lib/test/geometry_test.rb', line 79

def test_should_resize_with_greater_and_no_width
  assert_geometry 50, 64,
    "x40>"  => [31, 40],
    "x60>"  => [47, 60],
    "x100>" => [50, 64]
end

#test_should_resize_with_lessObject



47
48
49
50
51
52
53
54
# File 'lib/test/geometry_test.rb', line 47

def test_should_resize_with_less
  assert_geometry 50, 64,
    "50x50<"   => [50, 64],
    "60x60<"   => [50, 64],
    "100x100<" => [78, 100],
    "100x112<" => [88, 112],
    "40x70<"   => [50, 64]
end

#test_should_resize_with_less_and_no_heightObject



63
64
65
66
67
68
# File 'lib/test/geometry_test.rb', line 63

def test_should_resize_with_less_and_no_height
  assert_geometry 50, 64,
    "50<"  => [50, 64],
    "60<"  => [60, 77],
    "100<" => [100, 128]
end

#test_should_resize_with_less_and_no_widthObject



56
57
58
59
60
61
# File 'lib/test/geometry_test.rb', line 56

def test_should_resize_with_less_and_no_width
  assert_geometry 50, 64,
    "x50<"  => [50, 64],
    "x60<"  => [50, 64],
    "x100<" => [78, 100]
end

#test_should_resize_with_percentObject



26
27
28
29
30
31
# File 'lib/test/geometry_test.rb', line 26

def test_should_resize_with_percent
  assert_geometry 50, 64,
    "50x50%"   => [25, 32],
    "60x60%"   => [30, 38],
    "120x112%" => [60, 72]
end

#test_should_resize_with_percent_and_no_heightObject



40
41
42
43
44
45
# File 'lib/test/geometry_test.rb', line 40

def test_should_resize_with_percent_and_no_height
  assert_geometry 50, 64,
    "50%"  => [25, 32],
    "60%"  => [30, 38],
    "120%" => [60, 77]
end

#test_should_resize_with_percent_and_no_widthObject



33
34
35
36
37
38
# File 'lib/test/geometry_test.rb', line 33

def test_should_resize_with_percent_and_no_width
  assert_geometry 50, 64,
    "x50%"  => [50, 32],
    "x60%"  => [50, 38],
    "x112%" => [50, 72]
end