Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / tools / assoc_mem / test.cpp
blobe789cd6ed949c92b2b16eda23e12db88e6450893
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "attribute.h"
18 #include "node.h"
19 #include "brain.h"
20 #include "tree.h"
21 #include "value.h"
22 #include "cond_node.h"
23 #include "result_node.h"
25 #include <iostream>
26 #include <valarray>
27 #include <math.h>
29 void test1()
31 CBrain brain(10,10,10,10,10);
32 CTree tree;
34 CBoolField viande("Viande");
35 CBoolField grand("Grand");
36 CBoolField bon("Bon");
37 std::vector<std::string> vals_couleur;
38 vals_couleur.push_back(std::string("Vert"));
39 vals_couleur.push_back(std::string("Rouge"));
40 CStringField couleur(std::string("Couleur"), vals_couleur);
42 brain.addField(&viande);
43 brain.addField(&grand);
44 brain.addField(&bon);
45 brain.addField( (CField *) &couleur);
47 tree.setKey(2);
48 brain.addTree( &tree );
50 CValue<bool> val1(true);
51 CValue<bool> val2(false);
52 CValue<std::string> val3("Vert");
53 CValue<std::string> val4("Rouge");
54 CValue<std::string> val5("Orange");
56 CRecord r1;
57 r1.addValue( &val1);
58 r1.addValue( &val1);
59 r1.addValue( &val1 );
60 r1.addValue( &val4 );
62 CRecord r2;
63 r2.addValue( &val2);
64 r2.addValue( &val2);
65 r2.addValue( &val2 );
66 r2.addValue( &val4 );
68 CRecord r3;
69 r3.addValue( &val1 );
70 r3.addValue( &val1 );
71 r3.addValue( &val1 );
72 r3.addValue( &val3 );
74 CRecord r4;
75 r4.addValue( &val2);
76 r4.addValue( &val2);
77 r4.addValue( &val2);
78 r4.addValue( &val5);
80 CRecord r5;
81 r5.addValue( &val2 );
82 r5.addValue( &val2 );
83 r5.addValue( &val2 );
84 r5.addValue( &val3);
86 CRecord r6;
87 r6.addValue( &val2 );
88 r6.addValue( &val1 );
89 r6.addValue( &val2 );
90 r6.addValue( &val4 );
92 CRecord r7;
93 r7.addValue( &val1 );
94 r7.addValue( &val2 );
95 r7.addValue( &val2 );
96 r7.addValue( &val3 );
98 CRecord r8;
99 r8.addValue( &val1 );
100 r8.addValue( &val1 );
101 r8.addValue( &val1 );
102 r8.addValue( &val3 );
104 CRecord r9;
105 r9.addValue( &val1 );
106 r9.addValue( &val1 );
107 r9.addValue( &val1 );
108 r9.addValue( &val3 );
110 CRecord r10;
111 r10.addValue( &val2 );
112 r10.addValue( &val1 );
113 r10.addValue( &val2 );
114 r10.addValue( &val4 );
116 brain.setInput(&r1);
117 brain.setInput(&r2);
118 brain.setInput(&r3);
119 brain.setInput(&r4);
120 brain.setInput(&r5);
121 brain.setInput(&r6);
122 brain.setInput(&r7);
123 brain.setInput(&r8);
124 brain.setInput(&r9);
125 brain.setInput(&r10);
127 brain.build();
128 std::cout << brain.getDebugString();
130 brain.setInput(&r7);
134 void test2()
136 std::string age_old("old");
137 std::string age_mid("mid");
138 std::string age_new("new");
140 std::vector<std::string> vals_age;
141 vals_age.push_back( age_old );
142 vals_age.push_back( age_mid );
143 vals_age.push_back( age_new );
144 CStringField age(std::string("AGE"), vals_age);
146 CValue<bool> val_true(true);
147 CValue<bool> val_false(false);
150 CBoolField competition(std::string("Competition"));
152 std::string type_swr("swr");
153 std::string type_hwr("hwr");
155 std::vector<std::string> vals_type;
156 vals_type.push_back( type_swr );
157 vals_type.push_back( type_hwr );
158 CStringField type(std::string("TYPE"), vals_type);
160 CBoolField profit("Profit");
162 CBrain brain(10,10,10,10,10);
163 CTree tree;
165 brain.addField( &age );
166 brain.addField( &competition );
167 brain.addField( &type );
168 brain.addField( &profit );
170 tree.setKey( 3 );
171 brain.addTree( &tree );
173 CRecord r1;
174 r1.addValue( age_old );
175 r1.addValue( &val_true );
176 r1.addValue( type_swr );
177 r1.addValue( &val_false );
178 brain.addRecord( &r1 );
180 CRecord r2;
181 r2.addValue( age_old );
182 r2.addValue( &val_false );
183 r2.addValue( type_swr );
184 r2.addValue( &val_false );
185 brain.addRecord( &r2 );
187 CRecord r3;
188 r3.addValue( age_old );
189 r3.addValue( &val_false );
190 r3.addValue( type_hwr );
191 r3.addValue( &val_false );
192 brain.addRecord( &r3 );
194 CRecord r4;
195 r4.addValue( age_mid );
196 r4.addValue( &val_true );
197 r4.addValue( type_swr );
198 r4.addValue( &val_false );
199 brain.addRecord( &r4 );
201 CRecord r5;
202 r5.addValue( age_mid );
203 r5.addValue( &val_true );
204 r5.addValue( type_hwr );
205 r5.addValue( &val_false );
206 brain.addRecord( &r5 );
208 CRecord r6;
209 r6.addValue( age_mid );
210 r6.addValue( &val_false );
211 r6.addValue( type_hwr );
212 r6.addValue( &val_true );
213 brain.addRecord( &r6 );
215 CRecord r7;
216 r7.addValue( age_mid );
217 r7.addValue( &val_false );
218 r7.addValue( type_swr );
219 r7.addValue( &val_true );
220 brain.addRecord( &r7 );
222 CRecord r8;
223 r8.addValue( age_new );
224 r8.addValue( &val_true );
225 r8.addValue( type_swr );
226 r8.addValue( &val_true );
227 brain.addRecord( &r8 );
229 CRecord r9;
230 r9.addValue( age_new );
231 r9.addValue( &val_false );
232 r9.addValue( type_hwr );
233 r9.addValue( &val_true );
234 brain.addRecord( &r9 );
236 CRecord r10;
237 r10.addValue( age_new );
238 r10.addValue( &val_false );
239 r10.addValue( type_swr );
240 r10.addValue( &val_true );
241 brain.addRecord( &r10 );
243 brain.build();
244 brain.setInput( &r5 );
247 int main(int, char *[])
249 test2();