-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
61 lines (42 loc) · 1.21 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
#include "munode.h"
#include "mutext.h"
void muText_solve_sample_vartext(){
muText muT;
muT.solve_sample_vartext();
}
void parser_test(){
double a = 1;
double b = 0;
double c = 0;
mu::Parser parser;
parser.DefineVar("a", &a);
parser.DefineVar("b", &b);
parser.DefineVar("c", &c);
muNode *node=new muNode();
node->condition="";
node->expression="10+a";
std::cout<<"result condition:"<<node->evaluateCondition(parser)<<std::endl;
std::cout<<"result expression:"<<node->evaluateExpression(parser)<<std::endl;
}
void muText_file_Test(){
mu::Parser parser;
std::map<std::string, double*> varmap;
muText().create_sample_file();
muText().create_sample_subroutine_file();
muNode *node=muText().read_file_into_nodes_text("file.txt");
muText().process_nodes(node,varmap);
muText().process_nodes_nr(node);
muText().print_varmap(varmap);
muText().set_varmap_to_parser(varmap,parser);
muText().print_parser_varmap(parser);
node->printhierarchy(0);
muNode* N = node;
while(N->isValid(N)){
N= N->getNextNodeByCondition(parser);
N->printNode(parser);
}
}
int main() {
muText_file_Test();
return 0;
}