1 require File.dirname(__FILE__) + '/../test_helper'
3 class OldNodeTest < Test::Unit::TestCase
6 def test_node_too_far_north
7 invalid_node_test(:node_too_far_north)
10 def test_node_north_limit
11 valid_node_test(:node_north_limit)
14 def test_node_too_far_south
15 invalid_node_test(:node_too_far_south)
18 def test_node_south_limit
19 valid_node_test(:node_south_limit)
22 def test_node_too_far_west
23 invalid_node_test(:node_too_far_west)
26 def test_node_west_limit
27 valid_node_test(:node_west_limit)
30 def test_node_too_far_east
31 invalid_node_test(:node_too_far_east)
34 def test_node_east_limit
35 valid_node_test(:node_east_limit)
38 def test_totally_wrong
39 invalid_node_test(:node_totally_wrong)
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
45 def valid_node_test(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)
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
61 def invalid_node_test(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?