source: subversion/sites/rails_port/test/unit/old_node_test.rb @ 14668

Last change on this file since 14668 was 14586, checked in by tomhughes, 10 years ago

Merge api06 branch to trunk.

File size: 2.1 KB
Line 
1require File.dirname(__FILE__) + '/../test_helper'
2
3class OldNodeTest < Test::Unit::TestCase
4  api_fixtures
5
6  def test_node_too_far_north
7          invalid_node_test(:node_too_far_north)
8  end
9 
10  def test_node_north_limit
11    valid_node_test(:node_north_limit)
12  end
13 
14  def test_node_too_far_south
15    invalid_node_test(:node_too_far_south)
16  end
17 
18  def test_node_south_limit
19    valid_node_test(:node_south_limit)
20  end
21 
22  def test_node_too_far_west
23    invalid_node_test(:node_too_far_west)
24  end
25 
26  def test_node_west_limit
27    valid_node_test(:node_west_limit)
28  end
29 
30  def test_node_too_far_east
31    invalid_node_test(:node_too_far_east)
32  end
33 
34  def test_node_east_limit
35    valid_node_test(:node_east_limit)
36  end
37 
38  def test_totally_wrong
39    invalid_node_test(:node_totally_wrong)
40  end
41 
42  # This helper method will check to make sure that a node is within the world, and
43  # has the the same lat, lon and timestamp than what was put into the db by
44  # the fixture
45  def valid_node_test(nod)
46    node = nodes(nod)
47    dbnode = Node.find(node.id)
48    assert_equal dbnode.lat, node.latitude.to_f/SCALE
49    assert_equal dbnode.lon, node.longitude.to_f/SCALE
50    assert_equal dbnode.changeset_id, node.changeset_id
51    assert_equal dbnode.version, node.version
52    assert_equal dbnode.visible, node.visible
53    assert_equal dbnode.timestamp, node.timestamp
54    #assert_equal node.tile, QuadTile.tile_for_point(nodes(nod).lat, nodes(nod).lon)
55    assert_valid node
56  end
57 
58  # This helpermethod will check to make sure that a node is outwith the world,
59  # and has the same lat, lon and timesamp than what was put into the db by the
60  # fixture
61  def invalid_node_test(nod)
62    node = nodes(nod)
63    dbnode = Node.find(node.id)
64    assert_equal dbnode.lat, node.latitude.to_f/SCALE
65    assert_equal dbnode.lon, node.longitude.to_f/SCALE
66    assert_equal dbnode.changeset_id, node.changeset_id
67    assert_equal dbnode.version, node.version
68    assert_equal dbnode.visible, node.visible
69    assert_equal dbnode.timestamp, node.timestamp
70    #assert_equal node.tile, QuadTile.tile_for_point(nodes(nod).lat, nodes(nod).lon)
71    assert_equal false, node.valid?
72  end
73 
74
75end
Note: See TracBrowser for help on using the repository browser.