/[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 1388 - (hide annotations)
Fri Jan 11 07:45:58 2008 UTC (11 years, 9 months ago) by trankine
File size: 1823 byte(s)
And get the *(&(*&(* name right
1 ksteube 1312
2     /* $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 jgs 82 #include "boost/multi_array.hpp"
17     #include "multi_arrayTestCase.h"
18    
19     #include <iostream>
20    
21     using namespace CppUnitTest;
22     using namespace std;
23    
24     void multi_arrayTestCase::setUp() {
25     //
26     // This is called before each test is run
27    
28     }
29    
30     void multi_arrayTestCase::tearDown() {
31     //
32     // This is called after each test has been run
33    
34     }
35    
36     void multi_arrayTestCase::testAll() {
37     //
38     // Test boost multi_array
39     typedef boost::multi_array<double, 3> ArrayType;
40     typedef ArrayType::index_range range;
41     ArrayType testArr(boost::extents[1][2][3]);
42     cout << endl;
43     for (ArrayType::index i=0;i!=1;++i) {
44     for (ArrayType::index j=0;j!=2;++j) {
45     for (ArrayType::index k=0;k!=3;++k) {
46     testArr[i][j][k]=k+j*3+i*(1*2);
47     cout << "(" << i << "," << j << "," << k << ") "
48     << testArr[i][j][k] << endl;
49     }
50     }
51     }
52     ArrayType::index_gen indices;
53     ArrayType::array_view<2>::type OneView=testArr[ indices[range()][range()][1] ];
54     for (ArrayType::index i=0;i!=1;++i) {
55     for (ArrayType::index j=0;j!=2;++j) {
56     cout << "(" << i << "," << j << ",1) " << OneView[i][j] << endl;
57     }
58     }
59    
60     }
61    
62     TestSuite* multi_arrayTestCase::suite ()
63     {
64     //
65     // create the suite of tests to perform.
66     TestSuite *testSuite = new TestSuite ("multi_arrayTestCase");
67    
68     testSuite->addTest (new TestCaller< multi_arrayTestCase>("testAll",&multi_arrayTestCase::testAll));
69     return testSuite;
70     }
71    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26