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

Annotation of /trunk/escript/test/multi_arrayTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (hide annotations)
Tue Oct 26 06:53:54 2004 UTC (15 years ago) by jgs
Original Path: trunk/esys2/escript/test/multiTest/multi_arrayTestCase.cpp
File size: 2259 byte(s)
Initial revision

1 jgs 82 /*
2     *****************************************************************************
3     * *
4     * COPYRIGHT ACcESS - All Rights Reserved *
5     * *
6     * This software is the property of ACcESS. No part of this code *
7     * may be copied in any form or by any means without the expressed written *
8     * consent of ACcESS. Copying, use or modification of this software *
9     * by any unauthorised person is illegal unless that person has a software *
10     * license agreement with ACcESS. *
11     * *
12     *****************************************************************************
13     */
14     #include "boost/multi_array.hpp"
15     #include "multi_arrayTestCase.h"
16    
17     #include <iostream>
18    
19     using namespace CppUnitTest;
20     using namespace std;
21    
22     void multi_arrayTestCase::setUp() {
23     //
24     // This is called before each test is run
25    
26     }
27    
28     void multi_arrayTestCase::tearDown() {
29     //
30     // This is called after each test has been run
31    
32     }
33    
34     void multi_arrayTestCase::testAll() {
35     //
36     // Test boost multi_array
37     typedef boost::multi_array<double, 3> ArrayType;
38     typedef ArrayType::index_range range;
39     ArrayType testArr(boost::extents[1][2][3]);
40     cout << endl;
41     for (ArrayType::index i=0;i!=1;++i) {
42     for (ArrayType::index j=0;j!=2;++j) {
43     for (ArrayType::index k=0;k!=3;++k) {
44     testArr[i][j][k]=k+j*3+i*(1*2);
45     cout << "(" << i << "," << j << "," << k << ") "
46     << testArr[i][j][k] << endl;
47     }
48     }
49     }
50     ArrayType::index_gen indices;
51     ArrayType::array_view<2>::type OneView=testArr[ indices[range()][range()][1] ];
52     for (ArrayType::index i=0;i!=1;++i) {
53     for (ArrayType::index j=0;j!=2;++j) {
54     cout << "(" << i << "," << j << ",1) " << OneView[i][j] << endl;
55     }
56     }
57    
58     }
59    
60     TestSuite* multi_arrayTestCase::suite ()
61     {
62     //
63     // create the suite of tests to perform.
64     TestSuite *testSuite = new TestSuite ("multi_arrayTestCase");
65    
66     testSuite->addTest (new TestCaller< multi_arrayTestCase>("testAll",&multi_arrayTestCase::testAll));
67     return testSuite;
68     }
69    

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26