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

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

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

trunk/esys2/escript/test/DataBlocks2D/DataBlocks2DTestCase.cpp revision 117 by jgs, Fri Apr 1 05:48:57 2005 UTC trunk/escript/test/DataBlocks2DTestCase.cpp revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC
# Line 1  Line 1 
 // $Id$  
 /*  
  *****************************************************************************  
  *                                                                           *  
  *       COPYRIGHT  ACcESS  -  All Rights Reserved                           *  
  *                                                                           *  
  * This software is the property of ACcESS. No part of this code             *  
  * may be copied in any form or by any means without the expressed written   *  
  * consent of ACcESS.  Copying, use or modification of this software         *  
  * by any unauthorised person is illegal unless that person has a software   *  
  * license agreement with ACcESS.                                            *  
  *                                                                           *  
  *****************************************************************************  
 */  
1    
2  #include "escript/Data/DataBlocks2D.h"  /* $Id$ */
3    
4    /*******************************************************
5     *
6     *           Copyright 2003-2007 by ACceSS MNRF
7     *       Copyright 2007 by University of Queensland
8     *
9     *                http://esscc.uq.edu.au
10     *        Primary Business: Queensland, Australia
11     *  Licensed under the Open Software License version 3.0
12     *     http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16    #include "escript/DataBlocks2D.h"
17  #include "esysUtils/EsysException.h"  #include "esysUtils/EsysException.h"
18    
19  #include "DataBlocks2DTestCase.h"  #include "DataBlocks2DTestCase.h"
# Line 118  void DataBlocks2DTestCase::testAll() { Line 118  void DataBlocks2DTestCase::testAll() {
118    }    }
119    
120    {    {
121      cout << "\tTest DataBlocks2D for blockSize = 0." << endl;      cout << "\tTest DataBlocks2D exception for numRows = 0." << endl;
122      //      int numRows=0;
123      // every attempted access for a 0 size block should cause an exception      int numCols=8;
124        int blockSize=10;
125        try {
126            DataBlocks2D myData(numRows,numCols,blockSize);
127            assert(false);
128        }
129        catch(EsysException& e) {
130            assert(true);
131        }
132      }
133    
134      {
135        cout << "\tTest DataBlocks2D exception for numCols = 0." << endl;
136        int numRows=10;
137        int numCols=0;
138        int blockSize=10;
139        try {
140            DataBlocks2D myData(numRows,numCols,blockSize);
141            assert(false);
142        }
143        catch(EsysException& e) {
144            assert(true);
145        }
146      }
147    
148      {
149        cout << "\tTest DataBlocks2D exception for blockSize = 0." << endl;
150      int numRows=10;      int numRows=10;
151      int numCols=8;      int numCols=8;
152      int blockSize=0;      int blockSize=0;
153      int exceptionCount=0;      try {
154      DataBlocks2D myData(numRows,numCols,blockSize);          DataBlocks2D myData(numRows,numCols,blockSize);
155      for (int i=0;i<numRows;i++) {          assert(false);
156        for (int j=0;j<numCols;j++) {      }
157      try {      catch(EsysException& e) {
158        myData[myData.index(i,j)];          assert(true);
           assert(false);  
     }  
     catch(EsysException& e) {  
       ++exceptionCount;  
           assert(true);  
     }  
       }  
159      }      }
     assert(exceptionCount == numRows*numCols);  
160    }    }
161    
162    {    {
# Line 185  void DataBlocks2DTestCase::testAll() { Line 203  void DataBlocks2DTestCase::testAll() {
203      }      }
204    }    }
205    
206      #if defined DOASSERT
207    {    {
208      cout << "\tTest DOASSERT exception." << endl;      cout << "\tTest DOASSERT exception." << endl;
209      DataBlocks2D myData;      DataBlocks2D myData;
# Line 196  void DataBlocks2DTestCase::testAll() { Line 215  void DataBlocks2DTestCase::testAll() {
215        assert(true);        assert(true);
216      }      }
217    }    }
218      #endif
219    
220  }  }
221    

Legend:
Removed from v.117  
changed lines
  Added in v.1312

  ViewVC Help
Powered by ViewVC 1.1.26