Changeset 709


Ignore:
Timestamp:
Dec 15, 2004, 9:33:42 AM (20 years ago)
Author:
duncan
Message:

added more tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/alpha_shape/test_alpha_shape.py

    r691 r709  
    9797
    9898
    99        
     99   
     100    def test_alpha_optional_alpha(self):
     101        #print "test_alpha"
     102        a = [0.0, 0.0]
     103        b = [1.0, 0.0]
     104        c = [2.0, 0.0]
     105        d = [2.0, 2.0]
     106        e = [1.0, 2.0]
     107        f = [0.0, 2.0]
     108
     109        shape = Alpha_Shape([a,b,c,d,e,f])
     110        result = shape.get_boundary()
     111        #print "result",result
     112        answer = [(5, 0), (0, 1), (4, 5), (2, 3), (3, 4), (1, 2)]
     113        assert allclose(answer, result)
     114       
     115        optimum_alpha = shape.get_optimum_alpha()
     116        alpha = shape.get_alpha()
     117       
     118        self.failUnless( optimum_alpha == alpha,
     119                        'alpha is wrong!')
     120
     121        #New instance, setting optional alpha
     122        shape = Alpha_Shape([a,b,c,d,e,f], alpha = optimum_alpha)
     123        result = shape.get_boundary()
     124        #print "result",result
     125        answer = [(5, 0), (0, 1), (4, 5), (2, 3), (3, 4), (1, 2)]
     126        assert allclose(answer, result)
     127
     128        shape.set_alpha(optimum_alpha)
     129        result = shape.get_boundary()
     130        #print "result",result
     131        answer = [(5, 0), (0, 1), (4, 5), (2, 3), (3, 4), (1, 2)]
     132        assert allclose(answer, result)
     133       
     134       
     135           
    100136    def test_not_enough_points(self):
    101137        #print "test_not_enought_points"
Note: See TracChangeset for help on using the changeset viewer.