/[escript]/trunk/esys2/bruce/test/Bruce/BruceTestCase.cpp
ViewVC logotype

Diff of /trunk/esys2/bruce/test/Bruce/BruceTestCase.cpp

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

revision 152 by jgs, Thu Sep 22 01:55:00 2005 UTC revision 153 by jgs, Tue Oct 25 01:51:20 2005 UTC
# Line 141  void BruceTestCase::testZero() { Line 141  void BruceTestCase::testZero() {
141    AbstractContinuousDomain testbruce0_asAbstractContinuousDomain = testbruce0.asAbstractContinuousDomain();    AbstractContinuousDomain testbruce0_asAbstractContinuousDomain = testbruce0.asAbstractContinuousDomain();
142    AbstractDomain testbruce0_asAbstractDomain = testbruce0.asAbstractDomain();    AbstractDomain testbruce0_asAbstractDomain = testbruce0.asAbstractDomain();
143    
   cout << "\tTest copy constructor" << endl;  
   
144    Bruce testbruce1(testbruce0);    Bruce testbruce1(testbruce0);
145    
146      assert(testbruce0==testbruce1);
147    
148    assert(testbruce1.getDim()==0);    assert(testbruce1.getDim()==0);
149    
150    AbstractContinuousDomain testbruce1_asAbstractContinuousDomain = testbruce1.asAbstractContinuousDomain();    AbstractContinuousDomain testbruce1_asAbstractContinuousDomain = testbruce1.asAbstractContinuousDomain();
# Line 160  void BruceTestCase::testZero() { Line 160  void BruceTestCase::testZero() {
160    assert(dataShape.first==1);    assert(dataShape.first==1);
161    assert(dataShape.second==0);    assert(dataShape.second==0);
162    
163      Bruce testbruce2(v0, v1, v2, 0, 0, 0, origin);
164    
165      assert(testbruce0==testbruce2);
166      assert(!(testbruce0!=testbruce2));
167    
168  }  }
169    
170  void BruceTestCase::test1d() {  void BruceTestCase::test1d() {
# Line 203  void BruceTestCase::test1d() { Line 208  void BruceTestCase::test1d() {
208    AbstractContinuousDomain testbruce1_asAbstractContinuousDomain = testbruce1.asAbstractContinuousDomain();    AbstractContinuousDomain testbruce1_asAbstractContinuousDomain = testbruce1.asAbstractContinuousDomain();
209    AbstractDomain testbruce1_asAbstractDomain = testbruce1.asAbstractDomain();    AbstractDomain testbruce1_asAbstractDomain = testbruce1.asAbstractDomain();
210    
   cout << "\tTest copy constructor" << endl;  
   
211    Bruce testbruce2(testbruce1);    Bruce testbruce2(testbruce1);
212    
213      assert(testbruce2==testbruce1);
214    
215    assert(testbruce2.getDim()==1);    assert(testbruce2.getDim()==1);
216    
217    AbstractContinuousDomain testbruce2_asAbstractContinuousDomain = testbruce2.asAbstractContinuousDomain();    AbstractContinuousDomain testbruce2_asAbstractContinuousDomain = testbruce2.asAbstractContinuousDomain();
# Line 243  void BruceTestCase::test2d() { Line 248  void BruceTestCase::test2d() {
248    origin.push_back(0);    origin.push_back(0);
249    origin.push_back(0);    origin.push_back(0);
250    
251    Bruce testbruce0(v0, v1, v2, 1, 1, 0, origin);    Bruce testbruce0(v0, v1, v2, 1, 0, 0, origin);
252    
253    assert(testbruce0.getDim()==2);    assert(testbruce0.getDim()==2);
254    
# Line 260  void BruceTestCase::test2d() { Line 265  void BruceTestCase::test2d() {
265    v0.push_back(1);    v0.push_back(1);
266    v0.push_back(0);    v0.push_back(0);
267    
268    Bruce testbruce1(v0, v1, v2, 2, 2, 0, origin);    Bruce testbruce1(v0, v1, v2, 2, 0, 0, origin);
269    
270    assert(testbruce1.getDim()==2);    assert(testbruce1.getDim()==2);
271    
# Line 284  void BruceTestCase::test2d() { Line 289  void BruceTestCase::test2d() {
289    AbstractContinuousDomain testbruce2_asAbstractContinuousDomain = testbruce2.asAbstractContinuousDomain();    AbstractContinuousDomain testbruce2_asAbstractContinuousDomain = testbruce2.asAbstractContinuousDomain();
290    AbstractDomain testbruce2_asAbstractDomain = testbruce2.asAbstractDomain();    AbstractDomain testbruce2_asAbstractDomain = testbruce2.asAbstractDomain();
291    
   cout << "\tTest copy constructor" << endl;  
   
292    Bruce testbruce3(testbruce2);    Bruce testbruce3(testbruce2);
293    
294      assert(testbruce2==testbruce3);
295    
296    assert(testbruce3.getDim()==2);    assert(testbruce3.getDim()==2);
297    
298    AbstractContinuousDomain testbruce3_asAbstractContinuousDomain = testbruce3.asAbstractContinuousDomain();    AbstractContinuousDomain testbruce3_asAbstractContinuousDomain = testbruce3.asAbstractContinuousDomain();
# Line 325  void BruceTestCase::test3d() { Line 330  void BruceTestCase::test3d() {
330    origin.push_back(0);    origin.push_back(0);
331    origin.push_back(0);    origin.push_back(0);
332    
333    Bruce testbruce0(v0, v1, v2, 0, 0, 0, origin);    Bruce testbruce0(v0, v1, v2, 1, 0, 0, origin);
334    
335    assert(testbruce0.getDim()==3);    assert(testbruce0.getDim()==3);
336    
# Line 386  void BruceTestCase::test3d() { Line 391  void BruceTestCase::test3d() {
391    AbstractContinuousDomain testbruce3_asAbstractContinuousDomain = testbruce3.asAbstractContinuousDomain();    AbstractContinuousDomain testbruce3_asAbstractContinuousDomain = testbruce3.asAbstractContinuousDomain();
392    AbstractDomain testbruce3_asAbstractDomain = testbruce3.asAbstractDomain();    AbstractDomain testbruce3_asAbstractDomain = testbruce3.asAbstractDomain();
393    
   cout << "\tTest copy constructor" << endl;  
   
394    Bruce testbruce4(testbruce3);    Bruce testbruce4(testbruce3);
395    
396      assert(testbruce4==testbruce3);
397    
398    assert(testbruce4.getDim()==3);    assert(testbruce4.getDim()==3);
399    
400    AbstractContinuousDomain testbruce4_asAbstractContinuousDomain = testbruce4.asAbstractContinuousDomain();    AbstractContinuousDomain testbruce4_asAbstractContinuousDomain = testbruce4.asAbstractContinuousDomain();
# Line 512  void BruceTestCase::testSetToXcon() { Line 517  void BruceTestCase::testSetToXcon() {
517    
518    cout << "\t\t0d domain" << endl;    cout << "\t\t0d domain" << endl;
519    
520    Bruce testbruce1(v0, v1, v2, 0, 0, 0, origin);    Bruce testbruce1(v0, v1, v2, 1, 0, 0, origin);
521    shape.clear();    shape.clear();
522    Data data1(0.0,shape,continuousFunction(testbruce1.asAbstractContinuousDomain()));    Data data1(0.0,shape,continuousFunction(testbruce1.asAbstractContinuousDomain()));
523    testbruce1.setToX(data1);    testbruce1.setToX(data1);
# Line 532  void BruceTestCase::testSetToXcon() { Line 537  void BruceTestCase::testSetToXcon() {
537    
538    cout << "\t\t0d domain" << endl;    cout << "\t\t0d domain" << endl;
539    
540    Bruce testbruce2(v0, v1, v2, 0, 0, 0, origin);    Bruce testbruce2(v0, v1, v2, 1, 0, 0, origin);
541    shape.clear();    shape.clear();
542    shape.push_back(1);    shape.push_back(1);
543    Data data2(0.0,shape,continuousFunction(testbruce2.asAbstractContinuousDomain()),true);    Data data2(0.0,shape,continuousFunction(testbruce2.asAbstractContinuousDomain()),true);
# Line 570  void BruceTestCase::testSetToXcon() { Line 575  void BruceTestCase::testSetToXcon() {
575    
576    cout << "\t\t0d domain" << endl;    cout << "\t\t0d domain" << endl;
577    
578    Bruce testbruce4(v0, v1, v2, 0, 0, 0, origin);    Bruce testbruce4(v0, v1, v2, 1, 0, 0, origin);
579    shape.clear();    shape.clear();
580    shape.push_back(2);    shape.push_back(2);
581    Data data4(0.0,shape,continuousFunction(testbruce4.asAbstractContinuousDomain()),true);    Data data4(0.0,shape,continuousFunction(testbruce4.asAbstractContinuousDomain()),true);
# Line 632  void BruceTestCase::testSetToXcon() { Line 637  void BruceTestCase::testSetToXcon() {
637    
638    cout << "\t\t0d domain" << endl;    cout << "\t\t0d domain" << endl;
639    
640    Bruce testbruce7(v0, v1, v2, 0, 0, 0, origin);    Bruce testbruce7(v0, v1, v2, 1, 0, 0, origin);
641    shape.clear();    shape.clear();
642    shape.push_back(3);    shape.push_back(3);
643    Data data7(0.0,shape,continuousFunction(testbruce7.asAbstractContinuousDomain()),true);    Data data7(0.0,shape,continuousFunction(testbruce7.asAbstractContinuousDomain()),true);
# Line 920  void BruceTestCase::testSetToSizecon() { Line 925  void BruceTestCase::testSetToSizecon() {
925    
926    cout << "\t\t0d domain" << endl;    cout << "\t\t0d domain" << endl;
927    
928    Bruce testbruce1(v0, v1, v2, 0, 0, 0, origin);    Bruce testbruce1(v0, v1, v2, 1, 0, 0, origin);
929    Data data1(0.0,shape,continuousFunction(testbruce1.asAbstractContinuousDomain()));    Data data1(0.0,shape,continuousFunction(testbruce1.asAbstractContinuousDomain()));
930    testbruce1.setToSize(data1);    testbruce1.setToSize(data1);
931    
# Line 939  void BruceTestCase::testSetToSizecon() { Line 944  void BruceTestCase::testSetToSizecon() {
944    
945    cout << "\t\t0d domain" << endl;    cout << "\t\t0d domain" << endl;
946    
947    Bruce testbruce2(v0, v1, v2, 0, 0, 0, origin);    Bruce testbruce2(v0, v1, v2, 1, 0, 0, origin);
948    Data data2(0.0,shape,continuousFunction(testbruce2.asAbstractContinuousDomain()),true);    Data data2(0.0,shape,continuousFunction(testbruce2.asAbstractContinuousDomain()),true);
949    testbruce2.setToSize(data2);    testbruce2.setToSize(data2);
950    
# Line 973  void BruceTestCase::testSetToSizecon() { Line 978  void BruceTestCase::testSetToSizecon() {
978    
979    cout << "\t\t0d domain" << endl;    cout << "\t\t0d domain" << endl;
980    
981    Bruce testbruce4(v0, v1, v2, 0, 0, 0, origin);    Bruce testbruce4(v0, v1, v2, 1, 0, 0, origin);
982    Data data4(0.0,shape,continuousFunction(testbruce4.asAbstractContinuousDomain()),true);    Data data4(0.0,shape,continuousFunction(testbruce4.asAbstractContinuousDomain()),true);
983    testbruce4.setToSize(data4);    testbruce4.setToSize(data4);
984    
# Line 1026  void BruceTestCase::testSetToSizecon() { Line 1031  void BruceTestCase::testSetToSizecon() {
1031    
1032    cout << "\t\t0d domain" << endl;    cout << "\t\t0d domain" << endl;
1033    
1034    Bruce testbruce7(v0, v1, v2, 0, 0, 0, origin);    Bruce testbruce7(v0, v1, v2, 1, 0, 0, origin);
1035    Data data7(0.0,shape,continuousFunction(testbruce7.asAbstractContinuousDomain()),true);    Data data7(0.0,shape,continuousFunction(testbruce7.asAbstractContinuousDomain()),true);
1036    testbruce7.setToSize(data7);    testbruce7.setToSize(data7);
1037    
# Line 1249  void BruceTestCase::testSetToSizefun() { Line 1254  void BruceTestCase::testSetToSizefun() {
1254    
1255  }  }
1256    
1257    void BruceTestCase::testSetToXException() {
1258    
1259      cout << endl;
1260    
1261      //
1262      // test setToX method exception on function domains
1263    
1264      Bruce::DimVec v0;
1265      Bruce::DimVec v1;
1266      Bruce::DimVec v2;
1267      Bruce::DimVec origin;
1268    
1269      DataArrayView::ShapeType shape;
1270      shape.clear();
1271      shape.push_back(1);
1272    
1273      origin.clear();
1274    
1275      v0.clear();
1276      v1.clear();
1277      v2.clear();
1278    
1279      Bruce testbruce1(v0, v1, v2, 1, 0, 0, origin);
1280      Data data1(0.0,shape,function(testbruce1.asAbstractContinuousDomain()));
1281    
1282      try {
1283      testbruce1.setToX(data1);
1284        assert(false);
1285      }
1286      catch (EsysException& e) {
1287        assert(true);
1288      }
1289    
1290    }
1291    
1292    void BruceTestCase::testSetToSizeException() {
1293    
1294      cout << endl;
1295    
1296      //
1297      // test setToSize method exception on function domains
1298    
1299      Bruce::DimVec v0;
1300      Bruce::DimVec v1;
1301      Bruce::DimVec v2;
1302      Bruce::DimVec origin;
1303    
1304      DataArrayView::ShapeType shape;
1305      shape.clear();
1306      shape.push_back(1);
1307    
1308      origin.clear();
1309    
1310      v0.clear();
1311      v1.clear();
1312      v2.clear();
1313    
1314      Bruce testbruce1(v0, v1, v2, 1, 0, 0, origin);
1315      Data data1(0.0,shape,function(testbruce1.asAbstractContinuousDomain()));
1316    
1317      try {
1318      testbruce1.setToSize(data1);
1319        assert(false);
1320      }
1321      catch (EsysException& e) {
1322        assert(true);
1323      }
1324    
1325    }
1326    
1327  TestSuite* BruceTestCase::suite ()  TestSuite* BruceTestCase::suite ()
1328  {  {
1329    //    //
# Line 1266  TestSuite* BruceTestCase::suite () Line 1341  TestSuite* BruceTestCase::suite ()
1341    testSuite->addTest (new TestCaller< BruceTestCase>("testSetToXfun",&BruceTestCase::testSetToXfun));    testSuite->addTest (new TestCaller< BruceTestCase>("testSetToXfun",&BruceTestCase::testSetToXfun));
1342    testSuite->addTest (new TestCaller< BruceTestCase>("testSetToSizecon",&BruceTestCase::testSetToSizecon));    testSuite->addTest (new TestCaller< BruceTestCase>("testSetToSizecon",&BruceTestCase::testSetToSizecon));
1343    testSuite->addTest (new TestCaller< BruceTestCase>("testSetToSizefun",&BruceTestCase::testSetToSizefun));    testSuite->addTest (new TestCaller< BruceTestCase>("testSetToSizefun",&BruceTestCase::testSetToSizefun));
1344      testSuite->addTest (new TestCaller< BruceTestCase>("testSetToXException",&BruceTestCase::testSetToXException));
1345      testSuite->addTest (new TestCaller< BruceTestCase>("testSetToSizeException",&BruceTestCase::testSetToSizeException));
1346    return testSuite;    return testSuite;
1347  }  }

Legend:
Removed from v.152  
changed lines
  Added in v.153

  ViewVC Help
Powered by ViewVC 1.1.26