/[escript]/trunk/pycad/test/python/run_pycad_test.py
ViewVC logotype

Diff of /trunk/pycad/test/python/run_pycad_test.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 924 by gross, Tue Jan 9 22:50:43 2007 UTC revision 925 by gross, Wed Jan 10 22:40:00 2007 UTC
# Line 1075  class Test_PyCAD_Primitives(unittest.Tes Line 1075  class Test_PyCAD_Primitives(unittest.Tes
1075          p2=Point(2,2,2,0.3)          p2=Point(2,2,2,0.3)
1076          p3=Point(3,3,3,0.4)          p3=Point(3,3,3,0.4)
1077          p4=Point(1,2,3)          p4=Point(1,2,3)
1078          p5=Point(1,2,3)          p5=Point(10,20,3)
1079          p6=Point(1,2,3)          p6=Point(1,2,30)
1080    
1081          l01=Line(p0,p1)          l01=Line(p0,p1)
1082          l12=Arc(p3,p1,p2)          l12=Arc(p3,p1,p2)
# Line 1094  class Test_PyCAD_Primitives(unittest.Tes Line 1094  class Test_PyCAD_Primitives(unittest.Tes
1094          code=c.getGmshCommand()          code=c.getGmshCommand()
1095          self.failUnless(code == "Line Loop(14) = {8, 9, 10};", "gmsh command wrong.")          self.failUnless(code == "Line Loop(14) = {8, 9, 10};", "gmsh command wrong.")
1096    
1097    
1098            self.failUnless(not c.isColocated(p4),"CurveLoop is colocated with point.")
1099            self.failUnless(c.isColocated(c),"CurveLoop is not colocated with its self.")
1100            self.failUnless(c.isColocated(CurveLoop(l01,l12,l20)),"CurveLoop is not colocated with its copy.")
1101            self.failUnless(c.isColocated(CurveLoop(l20,l01,l12)),"CurveLoop is not colocated with its copy with shifted points.")
1102            self.failUnless(c.isColocated(CurveLoop(l20,l12,l01)),"CurveLoop is not colocated with its copy with shuffled points.")
1103            self.failUnless(not c.isColocated(CurveLoop(lx,ly,l12)),"CurveLoop is colocated with different CurveLoop.")
1104    
1105            self.failUnless(len(c) == 3, "wrong length")
1106    
1107            c.setLocalScale(3.)
1108            self.failUnless(p0.getLocalScale()==3., "p0 has wrong local scale.")
1109            self.failUnless(p1.getLocalScale()==3., "p1 has wrong local scale.")
1110            self.failUnless(p2.getLocalScale()==3., "p2 has wrong local scale.")
1111            self.failUnless(p4.getLocalScale()==3., "p4 has wrong local scale.")
1112    
1113          cc=c.getCurves()          cc=c.getCurves()
1114          self.failUnless(len(cc) == 3, "too many curves.")          self.failUnless(len(cc) == 3, "too many curves.")
1115          self.failUnless(l01 in cc, "l01 is missing")          self.failUnless(l01 in cc, "l01 is missing")
1116          self.failUnless(l12 in cc, "l12 is missing")          self.failUnless(l12 in cc, "l12 is missing")
1117          self.failUnless(l20 in cc, "l20 is missing")          self.failUnless(l20 in cc, "l20 is missing")
1118    
1119            p=c.getPrimitives()
1120            self.failUnless(len(p) == 9, "too many primitives.")
1121            self.failUnless(l01 in p, "l01 is missing")
1122            self.failUnless(l12 in p, "l21 is missing")
1123            self.failUnless(l20 in p, "l20 is missing")
1124            self.failUnless(p0 in p, "p0 is missing")
1125            self.failUnless(p1 in p, "p1 is missing")
1126            self.failUnless(p2 in p, "p2 is missing")
1127            self.failUnless(p3 in p, "p3 is missing")
1128            self.failUnless(p4 in p, "p4 is missing")
1129    
1130            cp=c.copy()
1131            self.failUnless(isinstance(cp,CurveLoop), "copy returns is not an arc.")
1132            self.failUnless(not cp == c, "copy equals source")
1133            cc=cp.getCurves()
1134            self.failUnless(len(cc) == 3, "too many primitives in copy.")
1135            self.failUnless(not l01 in cc,"copy uses l01.")
1136            self.failUnless(not l12 in cc,"copy uses l12.")
1137            self.failUnless(not l20 in cc,"copy uses l20.")
1138            
1139            p0_m=Point(0,0,0)
1140            p1_m=Point(-1,-1,-1)
1141            p2_m=Point(-2,-2,-2)
1142            p3_m=Point(-3,-3,-3)
1143            p4_m=Point(-1,-2,-3)
1144    
1145            l01_m=Line(p0_m,p1_m)
1146            l12_m=Arc(p3_m,p1_m,p2_m)
1147            l20_m=Spline(p2_m,p4_m,p0_m)
1148    
1149            dc=c.apply(Dilation(-1.))
1150            self.failUnless(dc.isColocated(CurveLoop(l01_m,l12_m,l20_m)),"dilation is wrong.")
1151            cc=dc.getCurves()
1152            self.failUnless(len(cc) == 3, "too many primitives in dilation result.")
1153            self.failUnless(not l01 in cc,"l01 is in dilation result.")
1154            self.failUnless(not l12 in cc,"l12 is in dilation result.")
1155            self.failUnless(not l20 in cc,"l20 is in dilation result.")
1156    
1157            c.modifyBy(Dilation(-1.))
1158            self.failUnless(c.isColocated(CurveLoop(l01_m,l12_m,l20_m)),"inplace dilation is wrong.")
1159            cc=c.getCurves()
1160            self.failUnless(len(cc) == 3, "too many primitives in modified object.")
1161            self.failUnless(l01 in cc,"l01 missed in  modified object.")
1162            self.failUnless(l12 in cc,"l12 missed in  modified object.")
1163            self.failUnless(l20 in cc,"l20 missed in  modified object.")
1164          
1165                    
1166  if __name__ == '__main__':  if __name__ == '__main__':
1167     suite = unittest.TestSuite()     suite = unittest.TestSuite()

Legend:
Removed from v.924  
changed lines
  Added in v.925

  ViewVC Help
Powered by ViewVC 1.1.26