Changeset 406


Ignore:
Timestamp:
Oct 15, 2004, 9:54:37 AM (20 years ago)
Author:
duncan
Message:

added a test (ungen), fixed typo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pmesh/meshHarness.py

    r369 r406  
    620620        #print "****************** fileName", fileName
    621621        m.exportASCIItrianglulationfile(fileName)
    622         print "******************"
    623         print "m", m
    624         print "******************"
     622        #print "******************"
     623        #print "m", m
     624        #print "******************"
    625625        m_returned = importMeshFromFile(fileName)
    626         print "m_returned",m_returned
    627         print "******************"
     626        #print "m_returned",m_returned
     627        #print "******************"
    628628        #print "****************** fileName", fileName
    629629        os.remove(fileName)
     
    838838        #    self.failUnless(userVert.y == inputVert.y,
    839839        #                    'y duplicate verts not removed')
     840
     841
     842    def test_removeDuplicatedVertices(self):
     843       
     844        fileName = tempfile.mktemp(".txt")
     845        file = open(fileName,"w")
     846        file.write("         1       ??      ??\n\
     847       0.0       0.0\n\
     848       1.0       0.0\n\
     849       1.0       1.0\n\
     850       0.0       1.0\n\
     851       0.0       0.0\n\
     852END\n\
     853         2      ?? ??\n\
     854       10.0       10.0\n\
     855       10.0       20.0\n\
     856       20.0       20.0\n\
     857       10.0       10.0\n\
     858END\n\
     859END\n")
     860        file.close()
     861       
     862       
     863        a = Vertex (0.0, 0.0) #, attributes = [1.1])
     864        b = Vertex (0.0, 40.0) #, attributes = [1.2])
     865        c = Vertex (40.0,40.0) #, attributes = [1.3])
     866        d = Vertex (40.0,0.0) #, attributes = [1.4])
     867   
     868        s1 = Segment(a,b)
     869        s2 = Segment(b,c)
     870        s3 = Segment(c,d)
     871        s4 = Segment(d,a)
     872     
     873        m = Mesh(userVertices=[a,b,c,d], userSegments=[s1,s2,s3,s4])
     874        dict = importUngenerateFile(fileName)
     875        m.addVertsSegs(dict)
     876           
     877        self.failUnless(len(m.userSegments) ==11,
     878                        'Segments not deleted.')
     879        self.failUnless(len(m.userVertices) == 11,
     880                        'Vertex deleted, instead of segment.')
     881        self.failUnless(m.userSegments[10].vertices[0] == m.userVertices[10],
     882                        'Vertex deleted, instead of segment.')
     883        self.failUnless(m.userSegments[10].vertices[1] == m.userVertices[8],
     884                        'Vertex deleted, instead of segment.')
    840885       
    841886#-------------------------------------------------------------
    842887if __name__ == "__main__":
    843     suite = unittest.makeSuite(meshTestCase,'teszt')
     888    suite = unittest.makeSuite(meshTestCase,'test')
    844889    runner = unittest.TextTestRunner()
    845890    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.