]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Win7 32 bits. Porting ze tests.
authorageay <ageay>
Wed, 16 Oct 2013 14:26:51 +0000 (14:26 +0000)
committerageay <ageay>
Wed, 16 Oct 2013 14:26:51 +0000 (14:26 +0000)
src/MEDLoader/Swig/MEDLoaderTest3.py

index 924ce9ca53e36cc77f5b532e454d66ffc64f89ab..7160f4cd1b633b485cb964f3f381fa40b80d20cf 100644 (file)
@@ -1971,36 +1971,40 @@ class MEDLoaderTest(unittest.TestCase):
         pass
 
     def testHeapMem1(self):
+        a=DataArrayInt() ; aa=a.getHeapMemorySize()
+        a.alloc(0,1)
+        strMulFac=a.getHeapMemorySize()-aa ; del a ; del aa
+        #
         m=MEDCouplingCMesh()
         arr=DataArrayDouble(10,1) ; arr.iota(0)
         m.setCoords(arr,arr)
         m=m.buildUnstructured()
         m.setName("mm")
         f=m.getMeasureField(ON_CELLS)
-        self.assertIn(m.getHeapMemorySize(),xrange(3552-100,3552+100))
-        self.assertIn(f.getHeapMemorySize(),xrange(4215-100,4215+100))
+        self.assertIn(m.getHeapMemorySize(),xrange(3552-100,3552+100+4*strMulFac))
+        self.assertIn(f.getHeapMemorySize(),xrange(4215-100,4215+100+8*strMulFac))
         #
         mm=MEDFileUMesh()
         mm.setMeshAtLevel(0,m)
-        self.assertIn(mm.getHeapMemorySize(),xrange(3889-100,3889+100))
+        self.assertIn(mm.getHeapMemorySize(),xrange(3889-100,3889+100+10*strMulFac))
         ff=MEDFileField1TS()
         ff.setFieldNoProfileSBT(f)
-        self.assertIn(ff.getHeapMemorySize(),xrange(711-40,711+20))
+        self.assertIn(ff.getHeapMemorySize(),xrange(711-40,711+20+4*strMulFac))
         #
         fff=MEDFileFieldMultiTS()
         fff.appendFieldNoProfileSBT(f)
-        self.assertIn(fff.getHeapMemorySize(),xrange(743-50,743+30))
+        self.assertIn(fff.getHeapMemorySize(),xrange(743-50,743+30+6*strMulFac))
         f.setTime(1.,0,-1)
         fff.appendFieldNoProfileSBT(f)
-        self.assertIn(fff.getHeapMemorySize(),xrange(1462-90,1462+50))
-        self.assertIn(fff[0,-1].getHeapMemorySize(),xrange(711-40,711+20))
+        self.assertIn(fff.getHeapMemorySize(),xrange(1462-90,1462+50+10*strMulFac))
+        self.assertIn(fff[0,-1].getHeapMemorySize(),xrange(711-40,711+20+4*strMulFac))
         f2=f[:50]
         f2.setTime(2.,1,-1)
         pfl=DataArrayInt.Range(0,50,1) ; pfl.setName("pfl")
         fff.appendFieldProfile(f2,mm,0,pfl)
-        self.assertIn(fff.getHeapMemorySize(),xrange(2178-130,2178+100))
-        self.assertIn(fff.getProfile("pfl_NORM_QUAD4").getHeapMemorySize(),xrange(215-10,215+10))
-        self.assertIn(fff[1,-1].getHeapMemorySize(),xrange(700-50,700+30))
+        self.assertIn(fff.getHeapMemorySize(),xrange(2178-130,2178+100+10*strMulFac))
+        self.assertIn(fff.getProfile("pfl_NORM_QUAD4").getHeapMemorySize(),xrange(215-10,215+10+2*strMulFac))
+        self.assertIn(fff[1,-1].getHeapMemorySize(),xrange(700-50,700+30+4*strMulFac))
         pass
 
     def testCurveLinearMesh1(self):
@@ -2871,6 +2875,10 @@ class MEDLoaderTest(unittest.TestCase):
 
     def testMEDFileFieldPartialLoading(self):
         fname="Pyfile69.med"
+        #
+        a=DataArrayInt() ; aa=a.getHeapMemorySize()
+        a.alloc(0,1)
+        strMulFac=a.getHeapMemorySize()-aa ; del a ; del aa
         # building a mesh containing 30 tri3 + 40 quad4
         tri=MEDCouplingUMesh("tri",2)
         tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
@@ -2911,7 +2919,7 @@ class MEDLoaderTest(unittest.TestCase):
         self.assertTrue(not ff0.getUndergroundDataArray().isAllocated())
         self.assertEqual(ff0.getUndergroundDataArray().getInfoOnComponents(),['X [km]','YY [mm]'])
         heap_memory_ref=ff0.getHeapMemorySize()
-        self.assertTrue(heap_memory_ref>=100 and heap_memory_ref<=200)
+        self.assertIn(heap_memory_ref,xrange(100,200+2*strMulFac))
         ff0.loadArrays() ##
         arr=DataArrayDouble(140) ; arr.iota() ; arr.rearrange(2)
         self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
@@ -2920,7 +2928,7 @@ class MEDLoaderTest(unittest.TestCase):
         ff0=MEDFileField1TS(fname,"FieldCellPfl",False)
         self.assertEqual(ff0.getUndergroundDataArray().getInfoOnComponents(),["XX [pm]","YYY [hm]"])
         heap_memory_ref=ff0.getHeapMemorySize()
-        self.assertTrue(heap_memory_ref>=150 and heap_memory_ref<=250)
+        self.assertIn(heap_memory_ref,xrange(150,250+6*strMulFac))
         ff0.loadArrays() ##
         arr=DataArrayDouble(100) ; arr.iota() ; arr.rearrange(2)
         self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
@@ -2938,7 +2946,7 @@ class MEDLoaderTest(unittest.TestCase):
         self.assertEqual(ff0.getUndergroundDataArray().getIJ(30,1),5.5)
         self.assertTrue(not ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
         heap_memory_ref=ff0.getHeapMemorySize()
-        self.assertTrue(heap_memory_ref>=1000 and heap_memory_ref<=1100)
+        self.assertIn(heap_memory_ref,xrange(1000,1100+2*strMulFac))
         ff0.unloadArrays()
         hmd=ff0.getHeapMemorySize()-heap_memory_ref
         self.assertEqual(hmd,-800) # -50*8*2
@@ -2947,7 +2955,7 @@ class MEDLoaderTest(unittest.TestCase):
         #
         ff0=MEDFileField1TS(fname,"FieldCellPfl",-1,-1,False)
         heap_memory_ref=ff0.getHeapMemorySize()
-        self.assertTrue(heap_memory_ref>=150 and heap_memory_ref<=250)
+        self.assertIn(heap_memory_ref,xrange(150,250+6*strMulFac))
         ff0.loadArrays() ##
         self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
         self.assertEqual(ff0.getHeapMemorySize()-heap_memory_ref,50*8*2)
@@ -2964,14 +2972,14 @@ class MEDLoaderTest(unittest.TestCase):
         #
         ff0=MEDFileAnyTypeFieldMultiTS.New(fname,fieldName,False)
         heap_memory_ref=ff0.getHeapMemorySize()
-        self.assertTrue(heap_memory_ref>=2000 and heap_memory_ref<=3000)
+        self.assertIn(heap_memory_ref,xrange(2000,3000+80*strMulFac))
         ff0.loadArrays()
         self.assertEqual(ff0.getHeapMemorySize()-heap_memory_ref,20*70*8*2)
         del ff0
         #
         ffs=MEDFileFields(fname,False)
         heap_memory_ref=ffs.getHeapMemorySize()
-        self.assertTrue(heap_memory_ref>=2400 and heap_memory_ref<=3500)
+        self.assertIn(heap_memory_ref,xrange(2400,3500+80*strMulFac))
         ffs.loadArrays()
         self.assertEqual(ffs.getHeapMemorySize()-heap_memory_ref,20*70*8*2+70*8*2+50*8*2)
         pass