Changeset 1504


Ignore:
Timestamp:
Jun 8, 2005, 12:58:27 PM (19 years ago)
Author:
ole
Message:

Got a few unit tests to work on linux (rounding problems)

Location:
inundation/ga/storm_surge/pyvolution
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/shallow_water.py

    r1489 r1504  
    5656
    5757from domain import *
    58 from region import *
    59 from realtime_visualisation_new import Visualiser
     58from region import *#
     59
    6060Generic_domain = Domain #Rename
    6161
     
    111111        #Realtime visualisation
    112112        if self.visualiser is None:
     113            from realtime_visualisation_new import Visualiser           
    113114            self.visualiser = Visualiser(self,scale_z)
    114115        self.visualise = True
  • inundation/ga/storm_surge/pyvolution/test_quantity.py

    r1486 r1504  
    285285        #The central triangle (1)
    286286        #(using standard gradient based on neigbours controid values)
    287         assert a[1] == 2.0
    288         assert b[1] == 0.0
     287        assert allclose(a[1], 2.0)
     288        assert allclose(b[1], 0.0)
    289289
    290290
     
    292292        #q0 = q1 + a*(x0-x1) + b*(y0-y1)  <=>
    293293        #2  = 4  + a*(-2/3)  + b*(-2/3)
    294         assert a[0] + b[0] == 3
     294        assert allclose(a[0] + b[0], 3)
    295295        #From orthogonality (a*(y0-y1) + b*(x0-x1) == 0)       
    296         assert a[0] - b[0] == 0
     296        assert allclose(a[0] - b[0], 0)
    297297
    298298
     
    300300        #q2 = q1 + a*(x2-x1) + b*(y2-y1)  <=>
    301301        #6  = 4  + a*(4/3)  + b*(-2/3)       
    302         assert 2*a[2] - b[2] == 3
     302        assert allclose(2*a[2] - b[2], 3)
    303303        #From orthogonality (a*(y1-y2) + b*(x2-x1) == 0)
    304         assert a[2] + 2*b[2] == 0
     304        assert allclose(a[2] + 2*b[2], 0)
    305305
    306306
     
    308308        #q3 = q1 + a*(x3-x1) + b*(y3-y1)  <=>
    309309        #2  = 4  + a*(-2/3)  + b*(4/3)       
    310         assert a[3] - 2*b[3] == 3
     310        assert allclose(a[3] - 2*b[3], 3)
    311311        #From orthogonality (a*(y1-y3) + b*(x3-x1) == 0)       
    312         assert 2*a[3] + b[3] == 0
     312        assert allclose(2*a[3] + b[3], 0)
    313313
    314314
     
    339339        #print a, b
    340340
    341         assert a[1] == 3.0
    342         assert b[1] == 1.0
     341        assert allclose(a[1], 3.0)
     342        assert allclose(b[1], 1.0)
    343343       
    344344        #Work out the others
Note: See TracChangeset for help on using the changeset viewer.