/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 *
 * Introduction.cpp
 *
 *  Created on: March 2019
 *      Author: pgess <v.melnychenko@xreate.org>
 */

#include "xreatemanager.h"
#include "transcendlayer.h"
#include "supplemental/docutils.h"
#include <gtest/gtest.h>

using namespace xreate;
using namespace std;

TEST(Introduction, Doc_Example_1){
  string codePreamble = R"CODE(
    zeroDivisionErrCode = function:: int {0}
)CODE";
  string example = getDocumentationExampleById("documentation/index.xml", "Example_1");
  string rules = getDocumentationExampleById("documentation/index.xml", "Transcend_Example_1");
  std::unique_ptr<XreateManager> man(XreateManager::prepare(codePreamble + example));
  man->transcend->addRawScript(move(rules));
  
  int (* main)() = (int (*)()) man->run();
}