All pastes #80405 Raw Edit

Garo

public text v1 · immutable
·published 2006-07-06 11:29 UTC
rendered paste body
import model
import unittest
import snake
import time

from model import Geoposition

class Geoposition_TestCase(unittest.TestCase):
    
    def test_canGreateGeoposition(self):
        a = Geoposition(1.5, 2.0)
        
        self.assertAlmostEqual(1.5, a.latitude)
        self.assertAlmostEqual(2.0, a.longitude)
    

    def test_poleProblem(self):
        
        target = Geoposition( -1.57062, 0.047123)
        p = Geoposition(-0.783933, 7.96195e-008)
        for i in xrange(1, 5):
            print str(p)
            a = p.getAzimuth(target)
            print "Azimuth: %f" % a
            p = p.getEndpoint(a, 1000)
            
        s = "%f" % a
        self.assertNotEqual("-1.#IND00", s)
            
tests = unittest.TestSuite()                        
snake.unittest.addTests(tests, Geoposition_TestCase)


--------------- OUTPUT ---------

[Geoposition -0.783933, 7.96195e-008 rad]
Azimuth: 3.141593
[Geoposition -0.940719, 1.02787e-007 rad]
Azimuth: 3.141593
[Geoposition -1.09751, 1.32735e-007 rad]
Azimuth: 3.141593
[Geoposition -1.25429, 1.76593e-007 rad]
Azimuth: -1.#IND00