Changeset 6973


Ignore:
Timestamp:
May 5, 2009, 6:24:13 PM (15 years ago)
Author:
ole
Message:

Added test for out of bounds segments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/pmesh/test_mesh_interface.py

    r6199 r6973  
    671671
    672672    def FIXME_test_create_mesh_with_multiply_tagged_segments(self):
    673         """Test that create_mesh_from_regions fails when
    674         segments are listed repeatedly in boundary_tags.
     673        """Test that create_mesh_from_regions fails when segments are listed repeatedly in boundary_tags.
    675674        """
    676675       
    677        
    678        
    679 
     676        # FIXME(Ole): Who wrote this and why doesn't it pass?
     677       
     678       
    680679        # These are the absolute values
    681680        min_x = 10
     
    701700
    702701
    703 
     702        m = create_mesh_from_regions(polygon,
     703                                     boundary_tags,
     704                                     10000000,
     705                                     interior_regions=interior_regions)
    704706        try:
    705707            m = create_mesh_from_regions(polygon,
     
    712714            msg = 'Tags are listed repeatedly, but create mesh from regions '
    713715            msg += 'does not cause an Exception to be raised'
    714             raise msg
    715 
    716        
     716            raise Exception, msg
     717
     718
     719           
     720    def test_create_mesh_with_segments_out_of_bounds(self):
     721        """Test that create_mesh_from_regions fails when a segment is out of bounds.
     722        """
     723       
     724        # These are the absolute values
     725        min_x = 10
     726        min_y = 88
     727        polygon = [[min_x,min_y],[1000,100],[1000,1000],[100,1000]]
     728
     729       
     730        boundary_tags = {'walls': [0,1], 'bom':[2,3], 'out': [5]}
     731
     732        # This one is inside bounding polygon - should pass
     733        inner_polygon = [[800,400],[900,500],[800,600]]
     734       
     735        interior_regions = [(inner_polygon, 5)]
     736
     737
     738        try:
     739            m = create_mesh_from_regions(polygon,
     740                                         boundary_tags,
     741                                         10000000,
     742                                         interior_regions=interior_regions)
     743        except:
     744            pass
     745        else:
     746            msg = 'Tags are listed repeatedly, but create mesh from regions '
     747            msg += 'does not cause an Exception to be raised'
     748            raise Exception, msg
     749           
     750                   
    717751
    718752
     
    9761010#-------------------------------------------------------------
    9771011if __name__ == "__main__":
    978     suite = unittest.makeSuite(TestCase,'test')
     1012    suite = unittest.makeSuite(TestCase, 'test')
    9791013    #suite = unittest.makeSuite(TestCase,'test_create_mesh_from_regions_check_segs')
    9801014    runner = unittest.TextTestRunner() #verbosity=2)
Note: See TracChangeset for help on using the changeset viewer.