/[escript]/trunk/escript/test/DataTestCase.cpp
ViewVC logotype

Diff of /trunk/escript/test/DataTestCase.cpp

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

revision 2146 by jfenwick, Fri Nov 28 01:52:12 2008 UTC revision 2147 by jfenwick, Wed Dec 10 04:41:26 2008 UTC
# Line 26  Line 26 
26    
27  #include "escript/Data.h"  #include "escript/Data.h"
28  #include "escript/DataLazy.h"  #include "escript/DataLazy.h"
29    #include "escript/EscriptParams.h"
30    
31    #define AUTOLAZYON setEscriptParamInt("AUTOLAZY",1);
32    #define AUTOLAZYOFF setEscriptParamInt("AUTOLAZY",0);
33    #define CHECKAUTOLAZY (getEscriptParamInt("AUTOLAZY")==1)
34    #define SAVELAZYSTATE int LAZYSTATE=getEscriptParamInt("AUTOLAZY");
35    #define RESTORELAZYSTATE setEscriptParamInt("AUTOLAZY",LAZYSTATE);
36    
37    
38    
39  using namespace std;  using namespace std;
# Line 409  void DataTestCase::testSlicing() { Line 417  void DataTestCase::testSlicing() {
417    testSlicingWorker(true);    testSlicingWorker(true);
418  }  }
419    
 void DataTestCase::testSome() {  
420    
421    void DataTestCase::testSomeDriver(bool autolazy)
422    {
423    cout << endl;    cout << endl;
424      SAVELAZYSTATE
425      if (autolazy)
426      {
427        AUTOLAZYON
428        cout << "\tNow testing using autolazy." << endl;
429      }
430    cout << "\tCreate a Data object." << endl;    cout << "\tCreate a Data object." << endl;
431    
432    DataTypes::ShapeType viewShape;    DataTypes::ShapeType viewShape;
# Line 433  void DataTestCase::testSome() { Line 447  void DataTestCase::testSome() {
447    
448    cout << "\tTest some basic operations" << endl;    cout << "\tTest some basic operations" << endl;
449    result=exData*cData;    result=exData*cData;
450    assert(result.isExpanded());    cout << CHECKAUTOLAZY << " " << result.isLazy() << " " << result.isExpanded()<< endl;
451      assert(CHECKAUTOLAZY?result.isLazy():result.isExpanded());
452    
453    assert(result.Lsup()==4);    assert(result.Lsup()==4);
454    assert(result.sup()==4);    assert(result.sup()==4);
# Line 449  void DataTestCase::testSome() { Line 464  void DataTestCase::testSome() {
464    cout << "\tExercise copyWithMask method" << endl;    cout << "\tExercise copyWithMask method" << endl;
465    exData.copyWithMask(result, exData.wherePositive());    exData.copyWithMask(result, exData.wherePositive());
466    assert(!exData.wherePositive().isEmpty());    assert(!exData.wherePositive().isEmpty());
467      RESTORELAZYSTATE
468    
469  }  }
470    
471    void DataTestCase::testSome() {
472      testSomeDriver(false);
473      testSomeDriver(true);
474    }
475    
476    
477    
478  // This method tests to see if resolve() produces results of the correct type  // This method tests to see if resolve() produces results of the correct type

Legend:
Removed from v.2146  
changed lines
  Added in v.2147

  ViewVC Help
Powered by ViewVC 1.1.26