-
Notifications
You must be signed in to change notification settings - Fork 3
/
PlayTestsShared.cpp
50 lines (36 loc) · 1.33 KB
/
PlayTestsShared.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// PlayTestsShared.cpp
// lemonscript
//
// Created by Donald Pinckney on 5/23/16.
// Copyright © 2016 Donald Pinckney. All rights reserved.
//
#include "PlayTestsShared.h"
#include <sstream>
#include <lemonscript/lemonscript.h>
#include <lemonscript/AvailableCppCommandDeclaration.h>
#include <lemonscript/LemonScriptState.h>
#include <lemonscript/LemonScriptCompiler.h>
#include "auto_functions.h"
using namespace lemonscript;
LemonScriptState * PlayTestsShared::play_tests_make_state() {
std::vector<const AvailableCppCommandDeclaration *> decls = AvailableCppCommandDeclaration::parseCppCommands(AutoGenerator::GetAutoGenerators());
LemonScriptState *state = new LemonScriptState();
state->declareAvailableCppCommands(decls);
return state;
}
void PlayTestsShared::run_at_path(std::string path, lemonscript::LemonScriptState *state) {
try {
lemonscript::LemonScriptCompiler *compiler = new lemonscript::LemonScriptCompiler(path, state);
int i = 0;
while (true) {
std::cout << "Iteration " << i++ << ":" << std::endl;
bool isDone = compiler->PeriodicUpdate();
if(isDone) { break; }
}
delete compiler;
delete state;
} catch (std::string error) {
std::cerr << error << std::endl;
}
}