seriestest.cc 2.47 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
4
5
/*! \file seriestest.cc
 * \brief test aff::Series class (implementation)
 * 
 * ----------------------------------------------------------------------------
 * 
thomas.forbriger's avatar
thomas.forbriger committed
6
 * $Id$
thomas.forbriger's avatar
thomas.forbriger committed
7
8
9
10
 * \author Thomas Forbriger
 * \date 17/12/2002
 * 
 * test aff::Series class (implementation)
thomas.forbriger's avatar
thomas.forbriger committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 *
 * ----
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. 
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * ----
thomas.forbriger's avatar
thomas.forbriger committed
27
28
29
30
31
 * 
 * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) 
 * 
 * REVISIONS and CHANGES 
 *  - 17/12/2002   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
32
33
 *  - 28/12/2002   V1.1   (thof)
 *                        - new term for containers of const elements
34
35
 *  - 19/12/2003   V1.2   (thof)
 *                        - working on series container
thomas.forbriger's avatar
thomas.forbriger committed
36
37
38
39
 * 
 * ============================================================================
 */
#define AFF_SERIESTEST_CC_VERSION \
40
  "AFF_SERIESTEST_CC   V1.2"
thomas.forbriger's avatar
thomas.forbriger committed
41
#define AFF_SERIESTEST_CC_CVSID \
thomas.forbriger's avatar
thomas.forbriger committed
42
  "$Id$"
thomas.forbriger's avatar
thomas.forbriger committed
43
44
45
46
47
48
49

#include <aff/series.h>
#include <aff/dump.h>

using std::cout;
using std::endl;

thomas.forbriger's avatar
thomas.forbriger committed
50
51
52
53
54
55
56
/*! \example tests/seriestest.cc
 *
 * Test series class aff::Series.
 *
 * \sa tests/seriestest.cc
 */

thomas.forbriger's avatar
thomas.forbriger committed
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! print headline
void section(const char* s)
{
  cout << endl
       << s << endl;
  const char* p=s;
  while (*p) {
    cout << "-";
    ++p;
  }
  cout << endl;
}

//! testing SharedHeap
int main()
{
  cout << AFF_SERIESTEST_CC_VERSION << endl;
  cout << AFF_SERIESTEST_CC_CVSID << endl;

  section("array dimensions");
thomas.forbriger's avatar
thomas.forbriger committed
77
78
  CODE( const int N=5 );
  CODE( const int N2=-5 );
thomas.forbriger's avatar
thomas.forbriger committed
79

80
  section("create a series container");
thomas.forbriger's avatar
thomas.forbriger committed
81
82
83
  CODE( aff::Series<int> A );
  CODE( aff::Series<int> B(N) );
  CODE( aff::Series<int> C(N2,N) );
84
  DUMP( A );
thomas.forbriger's avatar
thomas.forbriger committed
85
86
  DUMP( B );
  DUMP( C );
thomas.forbriger's avatar
thomas.forbriger committed
87
  CODE( A=B );
88
  DUMP( A );
thomas.forbriger's avatar
thomas.forbriger committed
89
90
  CODE( aff::ConstSeries<int> D(C) );
  CODE( for (int i=C.first(); i<=C.last(); i++) { C(i)=i; } );
91
  DUMP( D );
thomas.forbriger's avatar
thomas.forbriger committed
92
#ifdef ILLEGAL1
thomas.forbriger's avatar
thomas.forbriger committed
93
  CODE( D(6)=10 );
thomas.forbriger's avatar
thomas.forbriger committed
94
#endif
thomas.forbriger's avatar
thomas.forbriger committed
95
96
  CODE( D.shift(300) );
  DUMP( D );
thomas.forbriger's avatar
thomas.forbriger committed
97
98
99
}

/* ----- END OF seriestest.cc ----- */