#include <base/Application.h>
#include <base/collection/Array.h>
#include <base/collection/Functor.h>
#include <base/Functor.h>
#include <base/TypeInfo.h>
using namespace com::azure::dev::base;
private:
static const unsigned int MAJOR_VERSION = 1;
static const unsigned int MINOR_VERSION = 0;
public:
ArrayApplication()
{
}
void main()
{
fout << getFormalName() << " version "
<< MAJOR_VERSION << '.' << MINOR_VERSION << EOL
<< "The Base Framework (Test Suite)" << EOL
<< ENDL;
fout << "Initializing array" << ENDL;
fout << "Appending values (1, 2, 3, 4, and 5)" << ENDL;
fout << "ai: " << ai << ENDL;
fout << "Prepending (10, and 11)" << ENDL;
fout << "ai: " << ai << ENDL;
fout << "Inserting 21 at index 0" << ENDL;
fout << "Inserting 22 at index 4" << ENDL;
fout << "Inserting 23 at index 9" << ENDL;
fout << "ai: " << ai << ENDL;
fout <<
"Invalid insert (expecting OutOfRange) for size " << ai.
getSize() << ENDL;
try {
#if (!defined(_COM_AZURE_DEV__BASE__NO_EXCEPTIONS)) && \
(_COM_AZURE_DEV__BASE__ARCH != _COM_AZURE_DEV__BASE__SPARC64) && \
(_COM_AZURE_DEV__BASE__ARCH != _COM_AZURE_DEV__BASE__POWERPC64) && \
(_COM_AZURE_DEV__BASE__ARCH != _COM_AZURE_DEV__BASE__S390X)
#endif
}
fout << "Removing element at index 2" << ENDL;
fout << "ai: " << ai << ENDL;
fout << "Modifying enumeration of elements (multiply values by 2)" << ENDL;
fout << "ai: " << ai << ENDL;
fout << "Non-modifying enumerating elements of list (calculating sum)" << ENDL;
forEach(ai, sum);
fout <<
"Sum: " << sum.
getResult() << ENDL;
fout <<
"Size: " << ai.
getSize() << ENDL;
fout << "Removing all the elements" << ENDL;
fout <<
"Size: " << ai.
getSize() << ENDL;
Array<float> af = {1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f};
fout << "af: " << af << ENDL;
fout << "ad: " << ad << ENDL;
}
};
APPLICATION_STUB(ArrayApplication);