/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 =
 * virtualization.cpp
 *
 * Author: pgess <v.melnychenko@xreate.org>
 * Created on February 24, 2018, 4:30 PM
 */

#include "xreatemanager.h"
#include "gtest/gtest.h"
using namespace xreate;

TEST(Virtualization, test1){
    FILE* input = fopen("scripts/virtualization/test1.xreate","r");
    assert(input != nullptr);

    std::unique_ptr<XreateManager> man(XreateManager::prepare(input));

    int (*main)() = (int (*)())man->run();
    int result = main();

    ASSERT_EQ(1, result);
}

TEST(Virtualization, test2){
    FILE* input = fopen("scripts/virtualization/test2.xreate","r");
    assert(input != nullptr);

    std::unique_ptr<XreateManager> man(XreateManager::prepare(input));

    int (*main)() = (int (*)())man->run();
    int result = main();

    ASSERT_EQ(3, result);
}