/[escript]/trunk/escript/test/python/run_data_access.py
ViewVC logotype

Diff of /trunk/escript/test/python/run_data_access.py

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

revision 2593 by jfenwick, Mon Jun 22 07:27:31 2009 UTC revision 2594 by gross, Thu Aug 6 00:47:48 2009 UTC
# Line 31  class DataAccessTestCase(unittest.TestCa Line 31  class DataAccessTestCase(unittest.TestCa
31      def testtoListOfTuplesScalarOnNullDomain(self):      def testtoListOfTuplesScalarOnNullDomain(self):
32      inp=42.0      inp=42.0
33      d=Data(inp)      d=Data(inp)
34      t=d.toListOfTuples()[0]      t=d.toListOfTuples(scalarastuple=True)[0]
35      self.failUnless(type(t)==type((1.0,)), "Did not return tuple for scalar data")      self.failUnless(type(t)==type((1.0,)), "Did not return tuple for scalar data")
36      self.failUnless(abs(inp-t[0])<EPSILON, "Did not return correct value")      self.failUnless(abs(inp-t[0])<EPSILON, "Did not return correct value")
37      t=d.toListOfTuples(scalarastuple=False)[0]      t=d.toListOfTuples(scalarastuple=False)[0]
# Line 45  class DataAccessTestCase(unittest.TestCa Line 45  class DataAccessTestCase(unittest.TestCa
45      d=Data(inp,fs,True)      d=Data(inp,fs,True)
46      for x in range(5):      for x in range(5):
47          d.setValueOfDataPoint(x,43+x)          d.setValueOfDataPoint(x,43+x)
48      t=d.toListOfTuples()      t=d.toListOfTuples(scalarastuple=True)
49      self.failUnless(len(t)==5,"Returned list has the wrong length")      self.failUnless(len(t)==5,"Returned list has the wrong length")
50      total=0      total=0
51      for x in range(5):      for x in range(5):
# Line 55  class DataAccessTestCase(unittest.TestCa Line 55  class DataAccessTestCase(unittest.TestCa
55      d=Data(inp,fs,True)      d=Data(inp,fs,True)
56      for x in range(5):      for x in range(5):
57          d.setValueOfDataPoint(x,((x,x+1),(x+2,x+3)))          d.setValueOfDataPoint(x,((x,x+1),(x+2,x+3)))
58      t=d.toListOfTuples()      t=d.toListOfTuples(scalarastuple=True)
59      ok=True      ok=True
60      for x in range(5):      for x in range(5):
61          if t[x]!=((x,x+1),(x+2,x+3)): ok=False          if t[x]!=((x,x+1),(x+2,x+3)): ok=False
# Line 68  class DataAccessTestCase(unittest.TestCa Line 68  class DataAccessTestCase(unittest.TestCa
68      for x in range(15):      for x in range(15):
69          d.setValueOfDataPoint(x,x)          d.setValueOfDataPoint(x,x)
70      ok=True      ok=True
71      t=d.toListOfTuples()      t=d.toListOfTuples(scalarastuple=True)
72      for x in range(15):      for x in range(15):
73          if t[x]!=(x,): ok=False          if t[x]!=(x,): ok=False
74      self.failUnless(ok,"Returned scalar does not match")      self.failUnless(ok,"Returned scalar does not match")
# Line 76  class DataAccessTestCase(unittest.TestCa Line 76  class DataAccessTestCase(unittest.TestCa
76      d=Data(inp,fs,True)      d=Data(inp,fs,True)
77      for x in range(15):      for x in range(15):
78          d.setValueOfDataPoint(x,(2*(x/2),(2*(x/2)+1)))          d.setValueOfDataPoint(x,(2*(x/2),(2*(x/2)+1)))
79      t=d.toListOfTuples()      t=d.toListOfTuples(scalarastuple=True)
80      ok=True      ok=True
81      for x in range(15):      for x in range(15):
82          if t[x]!=(2*(x/2),2*(x/2)+1): ok=False          if t[x]!=(2*(x/2),2*(x/2)+1): ok=False
# Line 86  class DataAccessTestCase(unittest.TestCa Line 86  class DataAccessTestCase(unittest.TestCa
86      d=Data(inp,fs,True)      d=Data(inp,fs,True)
87      for x in range(15):      for x in range(15):
88          d.setValueOfDataPoint(x,((x,x+1),(x+2,x+3)))          d.setValueOfDataPoint(x,((x,x+1),(x+2,x+3)))
89      t=d.toListOfTuples()      t=d.toListOfTuples(scalarastuple=True)
90      ok=True      ok=True
91      for x in range(15):      for x in range(15):
92          if t[x]!=((x,x+1),(x+2,x+3)): ok=False          if t[x]!=((x,x+1),(x+2,x+3)): ok=False
# Line 96  class DataAccessTestCase(unittest.TestCa Line 96  class DataAccessTestCase(unittest.TestCa
96      d=Data(inp,fs,True)      d=Data(inp,fs,True)
97      for x in range(15):      for x in range(15):
98          d.setValueOfDataPoint(x,(((x,x+1),(x+2,x+3)),((x+4,x+5),(x+6,x+7))))          d.setValueOfDataPoint(x,(((x,x+1),(x+2,x+3)),((x+4,x+5),(x+6,x+7))))
99      t=d.toListOfTuples()      t=d.toListOfTuples(scalarastuple=True)
100      ok=True      ok=True
101      for x in range(15):      for x in range(15):
102          if t[x]!=(((x,x+1),(x+2,x+3)),((x+4,x+5),(x+6,x+7))): ok=False          if t[x]!=(((x,x+1),(x+2,x+3)),((x+4,x+5),(x+6,x+7))): ok=False

Legend:
Removed from v.2593  
changed lines
  Added in v.2594

  ViewVC Help
Powered by ViewVC 1.1.26