#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

#define tf(IsTrue) ((IsTrue) ? "True" : "False")

int main() {
   uCalc uc;
   uCalc::Transformer t;
   auto tokens = t.Tokens();
   tokens.Clear();
   tokens.Add("."); // Fallback

   auto tokenPlus = tokens.Add("[+]");
   auto tokenStar = tokens.Add("[*]");
   auto tokenCaret = tokens.Add("^");

   // LIFO order means precedence is: '^' > '*' > '+'
   cout << "Precedence Check:" << endl;
   cout << "Caret (^) > Star (*): " << tf(tokens.IndexOf(tokenCaret) > tokens.IndexOf(tokenStar)) << endl;
   cout << "Star (*) > Plus (+): " << tf(tokens.IndexOf(tokenStar) > tokens.IndexOf(tokenPlus)) << endl;

   // Test for a token not in this collection
   uCalc::Transformer t2;
   auto unaddedToken = t2.Tokens().Add("unrelated");
   cout << "Index of un-added token: " << tokens.IndexOf(unaddedToken) << endl;
}