-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
83 lines (68 loc) · 1.95 KB
/
main.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>
#include <map>
#include "LithpAtom.h"
#include "LithpDict.h"
#include "LithpExceptions.h"
#include "LithpInteger.h"
#include "LithpList.h"
#include "LithpOpChain.h"
#include "LithpLiteral.h"
#include "LithpFunctionCall.h"
#include "LithpPrimitive.h"
#include "LithpString.h"
#include "DelegateTest.h"
void testDict() {
LithpDict d;
LithpList l;
l.PushFront(new LithpInteger(2));
l.PushFront(new LithpString("Dooot"));
l.PushBack(Atom("test-atom"));
l.PushBack(Atom("another-atom"));
d.Put("test", new LithpInteger(1));
d.Put("foo", new LithpString("bar"));
d.Put("list", &l);
std::cout << "Dict: " << d.ToString() << std::endl;
}
void testCompare() {
LithpInteger one(1);
LithpInteger two(2);
LithpInteger oneTwo(1);
bool testA = one == two;
bool testB = one == oneTwo;
if (!testA) std::cout << "TestA pass" << std::endl;
if (testB) std::cout << "TestB pass" << std::endl;
LithpAtom *atomTest = Atom("test");
LithpAtom *atomTest2 = Atom("test");
bool testC = *atomTest == *atomTest2;
if (testC) std::cout << "TestC pass" << std::endl;
LithpString string1("test");
LithpString string2("foo");
LithpString string3("test");
bool testD = string1 == string2;
bool testE = string1 == string3;
if (!testD) std::cout << "TestD pass" << std::endl;
if (testE) std::cout << "TestE pass" << std::endl;
}
void testOpchain() {
LithpAtom *atomPrint = Atom("print");
std::cout << atomPrint->ToString() << std::endl;
LithpLiteral stringHelloWorld(new LithpString("Hello World!"));
ListOpChainType params;
params.PushBack(&stringHelloWorld);
LithpFunctionCall fnPrint(atomPrint, ¶ms);
std::cout << "FunctionCall ToString: " << fnPrint.ToString() << std::endl;
bool fool = false;
}
/*
* Lithp++ entry point
*/
int main(int argc, char** argv) {
testDict();
testCompare();
testOpchain();
DoDelegateTest();
std::cout << "Tests finished. Hit enter to finish." << std::endl;
std::string s;
std::getline(std::cin, s);
return 0;
}