This test program gives an example of the usage of the following classes, functions, and preprocessor macros:
#define AFF_SHAPETEST_CC_VERSION \
"AFF_SHAPETEST_CC V1.3"
#include<iostream>
using std::cout;
using std::endl;
void section(
const char* s,
const char l=
'-')
{
cout << endl << s << endl;
const char* p=s;
while (*p) { cout << l; ++p; }
cout << endl;
}
const char*
bvalue(
const bool& b)
{ if (b) return("true"); return("false"); }
#define BOOLIS( S ) cout << " *** " << #S << ": " << bvalue(S);
{
s2.tolast();
for (int i=0; i<nmax; i++)
{
cout.width(3); cout << i+1;
cout << " ";
cout.width(5); cout << s1.current() << "=[";
{
if (j) cout << ", ";
cout.width(2); cout << s1.index(j);
}
cout << "] ";
cout.width(5); cout <<
bvalue(s1.more());
cout.width(6); cout <<
bvalue(s1.valid());
cout << " ";
cout.width(5); cout << s2.current() << "=[";
{
if (j) cout << ", ";
cout.width(2); cout << s2.index(j);
}
cout << "] ";
cout.width(5); cout <<
bvalue(s2.less());
cout.width(6); cout <<
bvalue(s2.valid());
cout << endl;
s1.incr();
s2.decr();
}
}
{
section(
"Test shape class Strided",
'=');
section(
"Test shaper class Shaper");
cout << endl << "Basic usage:" << endl;
#ifdef ILLEGAL1
#warning intentionally compiling illegal code
cout << endl << "Illegal with limited dimensionality:" << endl;
#endif
cout << endl << "Usage for an external Fortran shape:" << endl;
section(
"Test subarrays and slicing");
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
{
cout << endl << "Basic functionality" << endl;
}
{
cout << endl << "Shape with gaps" << endl;
}
{
cout << endl << "Small array" << endl;
}
{
CODE( copy.collapse(2,6).collapse(2,3).shift(0,1000).setfirst(1,50); )
CODE( copy.collapse(1,7).collapse(2,3).shift(0,1000).setfirst(1,50); )
}
}