/*
                     Exercise Testing Environment
                             2007.11.08.
Expected output:
----------------
Template Exercises

First Exercise:
abs(-3); => 3
abs(-2.4); => 2.4
abs<int>(-4.1); => 4

Second Exercise:
Popping 3 times after pushing 1, 2 and 3 => 3, 2, 1

Third Exercise:
makeArray<3, int>(10); => [10, 10, 10]
makeArray<2>(std::string("templates")); => [templates, templates]
makeArray<1>(static_cast<float>(1.3)); => [1.3]

 */

#include <iostream>
#include <string>

#include "exercises.hh"

int main(int argc, char *argv[])
{
  std::cout << "Template Exercises" << std::endl;

  std::cout << "\nFirst Exercise:" << std::endl;
  std::cout << "abs(-3); => " << abs(-3) << std::endl;
  std::cout << "abs(-2.4); => " << abs(-2.4) << std::endl;
  std::cout << "abs<int>(-4.1); => " << abs<int>(-4.1) << std::endl;

  std::cout << "\nSecond Exercise:" << std::endl;

  Stack<int> stack;
  stack.push(1); stack.push(2); stack.push(3);
  std::cout << "Popping 3 times after pushing 1, 2 and 3 => ";
  std::cout << stack.pop() << ", ";
  std::cout << stack.pop() << ", ";
  std::cout << stack.pop() << std::endl;

  std::cout << "\nThird Exercise:" << std::endl;

  std::cout << "makeArray<3, int>(10); => ";
  int *array1 = makeArray<3, int>(10);
  std::cout << "[";
  for(int i = 0; i < 2; ++i) std::cout << array1[i] << ", ";
  std::cout << array1[2] << "]" << std::endl;

  std::cout << "makeArray<2>(std::string(\"templates\")); => ";
  std::string *array2 = makeArray<2>(std::string("templates"));
  std::cout << "[" << array2[0] << ", " << array2[1] << "]" << std::endl;

  std::cout << "makeArray<1>(static_cast<float>(1.3)); => ";
  float *array3 = makeArray<1>(static_cast<float>(1.3));
  std::cout << "[" << array3[0] << "]" << std::endl;

  delete[] array3;
  delete[] array2;
  delete[] array1;

  return 0;
}