seriestest.cc 1.85 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: seriestest.cc,v 1.6 2005-07-05 15:18:37 tforb Exp $
thomas.forbriger's avatar
thomas.forbriger committed
7
8
9
10
11
12
13
14
15
 * \author Thomas Forbriger
 * \date 17/12/2002
 * 
 * test aff::Series class (implementation)
 * 
 * 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
16
17
 *  - 28/12/2002   V1.1   (thof)
 *                        - new term for containers of const elements
18
19
 *  - 19/12/2003   V1.2   (thof)
 *                        - working on series container
thomas.forbriger's avatar
thomas.forbriger committed
20
21
22
23
 * 
 * ============================================================================
 */
#define AFF_SERIESTEST_CC_VERSION \
24
  "AFF_SERIESTEST_CC   V1.2"
thomas.forbriger's avatar
thomas.forbriger committed
25
#define AFF_SERIESTEST_CC_CVSID \
thomas.forbriger's avatar
thomas.forbriger committed
26
  "$Id: seriestest.cc,v 1.6 2005-07-05 15:18:37 tforb Exp $"
thomas.forbriger's avatar
thomas.forbriger committed
27
28
29
30
31
32
33

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

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

thomas.forbriger's avatar
thomas.forbriger committed
34
35
36
37
38
39
40
/*! \example tests/seriestest.cc
 *
 * Test series class aff::Series.
 *
 * \sa tests/seriestest.cc
 */

thomas.forbriger's avatar
thomas.forbriger committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! 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
61
62
  CODE( const int N=5 );
  CODE( const int N2=-5 );
thomas.forbriger's avatar
thomas.forbriger committed
63

64
  section("create a series container");
thomas.forbriger's avatar
thomas.forbriger committed
65
66
67
  CODE( aff::Series<int> A );
  CODE( aff::Series<int> B(N) );
  CODE( aff::Series<int> C(N2,N) );
68
  DUMP( A );
thomas.forbriger's avatar
thomas.forbriger committed
69
70
  DUMP( B );
  DUMP( C );
thomas.forbriger's avatar
thomas.forbriger committed
71
  CODE( A=B );
72
  DUMP( A );
thomas.forbriger's avatar
thomas.forbriger committed
73
74
  CODE( aff::ConstSeries<int> D(C) );
  CODE( for (int i=C.first(); i<=C.last(); i++) { C(i)=i; } );
75
  DUMP( D );
thomas.forbriger's avatar
thomas.forbriger committed
76
#ifdef ILLEGAL1
thomas.forbriger's avatar
thomas.forbriger committed
77
  CODE( D(6)=10 );
thomas.forbriger's avatar
thomas.forbriger committed
78
#endif
thomas.forbriger's avatar
thomas.forbriger committed
79
80
  CODE( D.shift(300) );
  DUMP( D );
thomas.forbriger's avatar
thomas.forbriger committed
81
82
83
}

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