1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #include <gtest/gtest.h>
25 #include <boost/lexical_cast.hpp>
26 namespace OCRepresentationTest
32 void parsedEqual(double expected, const std::string& actualStr)
34 double actual = boost::lexical_cast<double>(actualStr);
35 EXPECT_GE(actual, expected - .0000001);
36 EXPECT_LE(actual, expected + .0000001);
39 // getValueToString(all types)
40 TEST(OCRepresentationValueToString, Null)
42 static const std::string AttrName = "NullTest";
44 rep.setNULL(AttrName);
46 EXPECT_TRUE(rep.isNULL(AttrName));
47 EXPECT_EQ("(null)", rep.getValueToString(AttrName));
48 EXPECT_EQ("(null)", rep[AttrName].getValueToString());
51 TEST(OCRepresentationValueToString, Integer)
53 static const std::string AttrName = "IntTest";
56 rep.setValue(AttrName, -5);
57 EXPECT_EQ("-5", rep.getValueToString(AttrName));
58 EXPECT_EQ("-5", rep[AttrName].getValueToString());
60 rep.setValue(AttrName, 0);
61 EXPECT_EQ("0", rep.getValueToString(AttrName));
62 EXPECT_EQ("0", rep[AttrName].getValueToString());
64 rep.setValue(AttrName, 5);
65 EXPECT_EQ("5", rep.getValueToString(AttrName));
66 EXPECT_EQ("5", rep[AttrName].getValueToString());
68 rep.setValue(AttrName, 54321);
69 EXPECT_EQ("54321", rep.getValueToString(AttrName));
70 EXPECT_EQ("54321", rep[AttrName].getValueToString());
73 TEST(OCRepresentationValueToString, Double)
75 static const std::string AttrName = "DoubleTest";
78 rep.setValue(AttrName, -5.0);
79 parsedEqual(-5.0, rep.getValueToString(AttrName));
80 parsedEqual(-5.0, rep[AttrName].getValueToString());
82 rep.setValue(AttrName, 0.0);
83 parsedEqual(0.0, rep.getValueToString(AttrName));
84 parsedEqual(0.0, rep[AttrName].getValueToString());
86 rep.setValue(AttrName, 5.0);
87 parsedEqual(5.0, rep.getValueToString(AttrName));
88 parsedEqual(5.0, rep[AttrName].getValueToString());
90 rep.setValue(AttrName, 54321.0);
91 parsedEqual(54321.0, rep.getValueToString(AttrName));
92 parsedEqual(54321.0, rep[AttrName].getValueToString());
94 rep.setValue(AttrName, 3.55);
95 parsedEqual(3.55, rep.getValueToString(AttrName));
96 parsedEqual(3.55, rep[AttrName].getValueToString());
98 rep.setValue(AttrName, -4.95);
99 parsedEqual(-4.95, rep.getValueToString(AttrName));
100 parsedEqual(-4.95, rep[AttrName].getValueToString());
102 rep.setValue(AttrName, 99999.5555);
103 parsedEqual(99999.5555, rep.getValueToString(AttrName));
104 parsedEqual(99999.5555, rep[AttrName].getValueToString());
107 TEST(OCRepresentationValueToString, Boolean)
109 static const std::string AttrName = "BooleanTest";
110 OCRepresentation rep;
112 rep.setValue(AttrName, false);
113 EXPECT_EQ("false", rep.getValueToString(AttrName));
114 EXPECT_EQ("false", rep[AttrName].getValueToString());
116 rep.setValue(AttrName, true);
117 EXPECT_EQ("true", rep.getValueToString(AttrName));
118 EXPECT_EQ("true", rep[AttrName].getValueToString());
121 TEST(OCRepresentationValueToString, String)
123 static const std::string AttrName = "StringTest";
124 OCRepresentation rep;
126 rep.setValue(AttrName, std::string("test 1"));
127 EXPECT_EQ("test 1", rep.getValueToString(AttrName));
128 EXPECT_EQ("test 1", rep[AttrName].getValueToString());
130 rep.setValue(AttrName, std::string("test 2"));
131 EXPECT_EQ("test 2", rep.getValueToString(AttrName));
132 EXPECT_EQ("test 2", rep[AttrName].getValueToString());
135 TEST(OCRepresentationValueToString, SubRepresentation)
137 static const std::string AttrName = "SubRepTest";
138 OCRepresentation rep;
139 OCRepresentation sub1;
140 OCRepresentation sub2;
142 rep.setValue(AttrName, sub1);
143 EXPECT_EQ("OC::OCRepresentation", rep.getValueToString(AttrName));
144 EXPECT_EQ("OC::OCRepresentation", rep[AttrName].getValueToString());
146 rep.setValue(AttrName, sub2);
147 EXPECT_EQ("OC::OCRepresentation", rep.getValueToString(AttrName));
148 EXPECT_EQ("OC::OCRepresentation", rep[AttrName].getValueToString());
151 TEST(OCRepresentationValueToString, IntegerVector)
153 static const std::string AttrName = "VectorTest";
154 OCRepresentation rep;
156 vector<int> vect {1,2,3,4,5,6,7,8,9};
157 vector<int> vect2 {-5,-3,-1,0,5,3,2};
158 rep.setValue(AttrName, vect);
159 EXPECT_EQ("[1 2 3 4 5 6 7 8 9 ]", rep.getValueToString(AttrName));
160 EXPECT_EQ("[1 2 3 4 5 6 7 8 9 ]", rep[AttrName].getValueToString());
162 rep.setValue(AttrName, vect2);
163 EXPECT_EQ("[-5 -3 -1 0 5 3 2 ]", rep.getValueToString(AttrName));
164 EXPECT_EQ("[-5 -3 -1 0 5 3 2 ]", rep[AttrName].getValueToString());
167 TEST(OCRepresentationValueToString, IntegerVectorVector)
169 static const std::string AttrName = "VectorTest";
170 OCRepresentation rep;
172 vector<int> vect1 {1,2,3,4,5,6,7,8,9};
173 vector<int> vect2 {-5,-3,-1,0,5,3,2};
174 vector<vector<int>> vect{vect1, vect2};
176 rep.setValue(AttrName, vect);
177 static const string Expected = "[[1 2 3 4 5 6 7 8 9 ] [-5 -3 -1 0 5 3 2 ] ]";
178 EXPECT_EQ(Expected, rep.getValueToString(AttrName));
179 EXPECT_EQ(Expected, rep[AttrName].getValueToString());
182 TEST(OCRepresentationValueToString, IntegerVectorVectorVector)
184 static const std::string AttrName = "VectorTest";
185 OCRepresentation rep;
187 vector<int> vect11 {1,2,3,4,5,6,7,8,9};
188 vector<int> vect12 {-5,-3,-1,0,5,3,2};
189 vector<vector<int>> vect1{vect11, vect12};
190 vector<int> vect21 {2,0,1,6,9,3,8};
191 vector<int> vect22 {9,7,8,100003};
192 vector<vector<int>> vect2{vect21, vect22};
193 vector<vector<vector<int>>> vect{vect1, vect2};
194 rep.setValue(AttrName, vect);
195 static const std::string Expected =
196 "[[[1 2 3 4 5 6 7 8 9 ] [-5 -3 -1 0 5 3 2 ] ] [[2 0 1 6 9 3 8 ] [9 7 8 100003 ] ] ]";
197 EXPECT_EQ(Expected, rep.getValueToString(AttrName));
198 EXPECT_EQ(Expected, rep[AttrName].getValueToString());
201 TEST(OCRepresentationValueToString, DoubleVector)
203 static const std::string AttrName = "VectorTest";
204 OCRepresentation rep;
206 vector<double> vect {3.12, -5.3, 7.5, 1.110};
207 vector<double> vect2 {2.1, -555.5, 0.0001, -0.2};
208 rep.setValue(AttrName, vect);
209 EXPECT_EQ(rep.getValueToString(AttrName), rep[AttrName].getValueToString());
211 rep.setValue(AttrName, vect2);
212 EXPECT_EQ(rep.getValueToString(AttrName), rep[AttrName].getValueToString());
215 TEST(OCRepresentationValueToString, DoubleVectorVector)
217 static const std::string AttrName = "VectorTest";
218 OCRepresentation rep;
219 vector<double> vect1 {30.1,5.88,-22.0,0};
220 vector<double> vect2 {2.1,-55.5,0.1100,-.2};
221 vector<vector<double>> vect{vect1, vect2};
223 rep.setValue(AttrName, vect);
224 EXPECT_EQ(rep.getValueToString(AttrName), rep[AttrName].getValueToString());
227 TEST(OCRepresentationValueToString, DoubleVectorVectorVector)
229 static const std::string AttrName = "VectorTest";
230 OCRepresentation rep;
232 vector<double> vect11 {3.01, 5.88, -22.0, 0.0};
233 vector<double> vect12 {99.3,8.0,.01236,-.22};
234 vector<vector<double>> vect1{vect11, vect12};
235 vector<double> vect21 {9.0,-1};
236 vector<double> vect22 {-99.2};
237 vector<vector<double>> vect2{vect21, vect22};
238 vector<vector<vector<double>>> vect{vect1, vect2};
239 rep.setValue(AttrName, vect);
240 EXPECT_EQ(rep.getValueToString(AttrName), rep[AttrName].getValueToString());
243 TEST(OCRepresentationValueToString, BooleanVector)
245 static const std::string AttrName = "VectorTest";
246 OCRepresentation rep;
248 vector<bool> vect {true, false, false, true};
249 vector<bool> vect2 {false, false, false, true};
250 rep.setValue(AttrName, vect);
251 EXPECT_EQ("[true false false true ]", rep.getValueToString(AttrName));
252 EXPECT_EQ("[true false false true ]", rep[AttrName].getValueToString());
254 rep.setValue(AttrName, vect2);
255 EXPECT_EQ("[false false false true ]", rep.getValueToString(AttrName));
256 EXPECT_EQ("[false false false true ]", rep[AttrName].getValueToString());
259 TEST(OCRepresentationValueToString, BooleanVectorVector)
261 static const std::string AttrName = "VectorTest";
262 OCRepresentation rep;
264 vector<bool> vect1 {true, false, false, true};
265 vector<bool> vect2 {false, false, false, true};
266 vector<vector<bool>> vect{vect1, vect2};
268 rep.setValue(AttrName, vect);
269 static const string Expected="[[true false false true ] [false false false true ] ]";
271 EXPECT_EQ(Expected, rep.getValueToString(AttrName));
272 EXPECT_EQ(Expected, rep[AttrName].getValueToString());
275 TEST(OCRepresentationValueToString, BooleanVectorVectorVector)
277 static const std::string AttrName = "VectorTest";
278 OCRepresentation rep;
280 vector<bool> vect11 {true, false, false, true};
281 vector<bool> vect12 {false, false, false, true};
282 vector<vector<bool>> vect1{vect11, vect12};
283 vector<bool> vect21 {false, true, true, false};
284 vector<bool> vect22 {true, true, true, false};
285 vector<vector<bool>> vect2{vect21, vect22};
286 vector<vector<vector<bool>>> vect{vect1, vect2};
287 rep.setValue(AttrName, vect);
288 static const std::string Expected =
289 "[[[true false false true ] [false false false true ] ]"
290 " [[false true true false ] [true true true false ] ] ]";
291 EXPECT_EQ(Expected, rep.getValueToString(AttrName));
292 EXPECT_EQ(Expected, rep[AttrName].getValueToString());
295 TEST(OCRepresentationValueToString, StringVector)
297 static const std::string AttrName = "VectorTest";
298 OCRepresentation rep;
300 vector<string> vect {"s1", "s2", "s3"};
301 vector<string> vect2 {"s4", "s5", "s6"};
302 rep.setValue(AttrName, vect);
303 EXPECT_EQ("[s1 s2 s3 ]", rep.getValueToString(AttrName));
304 EXPECT_EQ("[s1 s2 s3 ]", rep[AttrName].getValueToString());
306 rep.setValue(AttrName, vect2);
307 EXPECT_EQ("[s4 s5 s6 ]", rep.getValueToString(AttrName));
308 EXPECT_EQ("[s4 s5 s6 ]", rep[AttrName].getValueToString());
311 TEST(OCRepresentationValueToString, StringVectorVector)
313 static const std::string AttrName = "VectorTest";
314 OCRepresentation rep;
316 vector<string> vect1 {"s1", "s2", "s3"};
317 vector<string> vect2 {"s4", "s5", "s6"};
318 vector<vector<string>> vect{vect1, vect2};
320 rep.setValue(AttrName, vect);
321 static const string Expected="[[s1 s2 s3 ] [s4 s5 s6 ] ]";
323 EXPECT_EQ(Expected, rep.getValueToString(AttrName));
324 EXPECT_EQ(Expected, rep[AttrName].getValueToString());
327 TEST(OCRepresentationValueToString, StringVectorVectorVector)
329 static const std::string AttrName = "VectorTest";
330 OCRepresentation rep;
332 vector<string> vect11 {"s1", "s2", "s3"};
333 vector<string> vect12 {"s4", "s5", "s6"};
334 vector<vector<string>> vect1{vect11, vect12};
335 vector<string> vect21 {"s7", "s8"};
336 vector<string> vect22 {"s9"};
337 vector<vector<string>> vect2{vect21, vect22};
338 vector<vector<vector<string>>> vect{vect1, vect2};
339 rep.setValue(AttrName, vect);
340 static const std::string Expected =
341 "[[[s1 s2 s3 ] [s4 s5 s6 ] ]"
342 " [[s7 s8 ] [s9 ] ] ]";
343 EXPECT_EQ(Expected, rep.getValueToString(AttrName));
344 EXPECT_EQ(Expected, rep[AttrName].getValueToString());
347 TEST(OCRepresentationValueToString, SubRepresentationVector)
349 static const std::string AttrName = "VectorTest";
350 OCRepresentation rep;
352 OCRepresentation sub1;
353 OCRepresentation sub2;
354 vector<OCRepresentation> vect {sub1, sub2};
355 rep.setValue(AttrName, vect);
356 EXPECT_EQ("[OC::OCRepresentation OC::OCRepresentation ]", rep.getValueToString(AttrName));
357 EXPECT_EQ("[OC::OCRepresentation OC::OCRepresentation ]", rep[AttrName].getValueToString());
360 TEST(OCRepresentationValueToString, SubRepresentationVectorVector)
362 static const std::string AttrName = "VectorTest";
363 OCRepresentation rep;
365 OCRepresentation sub1;
366 OCRepresentation sub2;
367 OCRepresentation sub3;
368 OCRepresentation sub4;
369 vector<OCRepresentation> vect1 {sub1, sub2};
370 vector<OCRepresentation> vect2 {sub3, sub4};
371 vector<vector<OCRepresentation>> vect{vect1, vect2};
372 rep.setValue(AttrName, vect);
373 static const string Expected = "[[OC::OCRepresentation OC::OCRepresentation ]"
374 " [OC::OCRepresentation OC::OCRepresentation ] ]";
375 EXPECT_EQ(Expected, rep.getValueToString(AttrName));
376 EXPECT_EQ(Expected, rep[AttrName].getValueToString());
379 TEST(OCRepresentationValueToString, SubRepresentationVectorVectorVector)
381 static const std::string AttrName = "VectorTest";
382 OCRepresentation rep;
384 OCRepresentation sub1;
385 OCRepresentation sub2;
386 OCRepresentation sub3;
387 OCRepresentation sub4;
388 OCRepresentation sub5;
389 OCRepresentation sub6;
391 vector<OCRepresentation> vect11 {sub1, sub2};
392 vector<OCRepresentation> vect12 {sub3, sub4};
393 vector<vector<OCRepresentation>> vect1{vect11, vect12};
394 vector<OCRepresentation> vect21 {sub5};
395 vector<OCRepresentation> vect22 {sub6};
396 vector<vector<OCRepresentation>> vect2{vect21, vect22};
397 vector<vector<vector<OCRepresentation>>> vect{vect1, vect2};
399 rep.setValue(AttrName, vect);
400 static const string Expected =
401 "[[[OC::OCRepresentation OC::OCRepresentation ] "
402 "[OC::OCRepresentation OC::OCRepresentation ] ] "
403 "[[OC::OCRepresentation ] [OC::OCRepresentation ] ] ]";
404 EXPECT_EQ(Expected, rep.getValueToString(AttrName));
405 EXPECT_EQ(Expected, rep[AttrName].getValueToString());
408 // Subscript get/set (all types)
409 TEST(OCRepresentationSubscript, NullPtr)
411 static const std::string AttrName = "NullTest";
412 OCRepresentation rep;
413 rep[AttrName] = nullptr;
414 EXPECT_TRUE(rep.isNULL(AttrName));
416 std::nullptr_t repout = rep[AttrName];
417 std::nullptr_t repout2;
418 repout2 = rep[AttrName];
420 EXPECT_EQ(nullptr, repout);
421 EXPECT_EQ(nullptr, repout2);
424 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
426 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
431 TEST(OCRepresentationSubscript, Integer)
433 static const std::string AttrName = "IntTest";
434 OCRepresentation rep;
436 rep[AttrName] = repsource;
437 int repout = rep[AttrName];
439 repout2 = rep[AttrName];
441 EXPECT_EQ(repsource, repout);
442 EXPECT_EQ(repsource, repout2);
445 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
447 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
452 TEST(OCRepresentationSubscript, Double)
454 static const std::string AttrName = "DoubleTest";
455 OCRepresentation rep;
456 double repsource = -5.33;
457 rep[AttrName] = repsource;
458 double repout = rep[AttrName];
460 repout2 = rep[AttrName];
462 EXPECT_EQ(repsource, repout);
463 EXPECT_EQ(repsource, repout2);
466 EXPECT_FALSE(rep.getValue<int>(AttrName, badout));
468 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
473 //Disabled this test due to older GCC v4.6 fails for this test.
474 //We will enable it when we have a fix for it.
475 TEST(OCRepresentationSubscript, DISABLED_Boolean)
477 static const std::string AttrName = "BooleanTest";
478 OCRepresentation rep;
479 bool repsource = true;
480 rep[AttrName] = repsource;
481 bool repout = rep[AttrName];
483 repout2 = rep[AttrName];
485 EXPECT_EQ(repsource, repout);
486 EXPECT_EQ(repsource, repout2);
489 rep[AttrName] = repsource;
490 repout = rep[AttrName];
492 EXPECT_EQ(repsource, repout);
495 EXPECT_FALSE(rep.getValue<int>(AttrName, badout));
497 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
502 TEST(OCRepresentationSubscript, String)
504 static const std::string AttrName = "StringTest";
505 OCRepresentation rep;
506 string repsource = "This is a string!";
507 rep[AttrName] = repsource;
508 string repout = rep[AttrName];
510 repout2 = rep[AttrName];
512 EXPECT_EQ(repsource, repout);
513 EXPECT_EQ(repsource, repout2);
516 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
520 TEST(OCRepresentationSubscript, SubRepresentation)
522 static const std::string AttrName = "SubRepresentationTest";
523 OCRepresentation rep;
524 OCRepresentation repsource;
525 repsource.setUri("This is a uri");
527 rep[AttrName] = repsource;
528 OCRepresentation repout = rep[AttrName];
529 OCRepresentation repout2;
530 repout2 = rep[AttrName];
532 //OCRepresentation doesn't overload equality, so this just compares
533 //the value we set to ensure we got the same one out;
534 EXPECT_EQ(repsource.getUri(), repout.getUri());
535 EXPECT_EQ(repsource.getUri(), repout2.getUri());
538 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
540 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
545 TEST(OCRepresentationSubscript, IntegerVector)
547 static const std::string AttrName = "VectorTest";
548 OCRepresentation rep;
549 vector<int> repsource {1,2,3,4};
550 rep[AttrName] = repsource;
551 vector<int> repout = rep[AttrName];
553 repout2 = rep[AttrName];
555 EXPECT_EQ(repsource, repout);
556 EXPECT_EQ(repsource, repout2);
559 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
561 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
566 TEST(OCRepresentationSubscript, IntegerVectorVector)
568 static const std::string AttrName = "VectorTest";
569 OCRepresentation rep;
570 vector<vector<int>> repsource {{1,2,3,4},{5,6,7,8}};
571 rep[AttrName] = repsource;
572 vector<vector<int>> repout = rep[AttrName];
573 vector<vector<int>> repout2;
574 repout2 = rep[AttrName];
576 EXPECT_EQ(repsource, repout);
577 EXPECT_EQ(repsource, repout2);
580 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
582 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
587 TEST(OCRepresentationSubscript, IntegerVectorVectorVector)
589 static const std::string AttrName = "VectorTest";
590 OCRepresentation rep;
591 vector<vector<vector<int>>> repsource {{{1,2,3,4},{5,6,7,8}},{{9,10,11},{21,13}}};
592 rep[AttrName] = repsource;
593 vector<vector<vector<int>>> repout = rep[AttrName];
594 vector<vector<vector<int>>> repout2;
595 repout2 = rep[AttrName];
597 EXPECT_EQ(repsource, repout);
598 EXPECT_EQ(repsource, repout2);
601 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
603 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
608 TEST(OCRepresentationSubscript, DoubleVector)
610 static const std::string AttrName = "VectorTest";
611 OCRepresentation rep;
612 vector<double> repsource {1.1,2.2,3.2,4.2};
613 rep[AttrName] = repsource;
614 vector<double> repout = rep[AttrName];
615 vector<double> repout2;
616 repout2 = rep[AttrName];
618 EXPECT_EQ(repsource, repout);
619 EXPECT_EQ(repsource, repout2);
622 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
624 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
629 TEST(OCRepresentationSubscript, DoubleVectorVector)
631 static const std::string AttrName = "VectorTest";
632 OCRepresentation rep;
633 vector<vector<double>> repsource {{1.1,2.2,3.2,4.3},{5.5,6.6,7.8,.8}};
634 rep[AttrName] = repsource;
635 vector<vector<double>> repout = rep[AttrName];
636 vector<vector<double>> repout2;
637 repout2 = rep[AttrName];
639 EXPECT_EQ(repsource, repout);
640 EXPECT_EQ(repsource, repout2);
643 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
645 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
650 TEST(OCRepresentationSubscript, DoubleVectorVectorVector)
652 static const std::string AttrName = "VectorTest";
653 OCRepresentation rep;
654 vector<vector<vector<double>>> repsource {{{1.1,2.5,3.5,4.4},{.5,.6,7.8,8.9}},
655 {{9.8,10.8,11.8},{2.1,1.3}}};
656 rep[AttrName] = repsource;
657 vector<vector<vector<double>>> repout = rep[AttrName];
658 vector<vector<vector<double>>> repout2;
659 repout2 = rep[AttrName];
661 EXPECT_EQ(repsource, repout);
662 EXPECT_EQ(repsource, repout2);
665 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
667 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
672 TEST(OCRepresentationSubscript, BooleanVector)
674 static const std::string AttrName = "VectorTest";
675 OCRepresentation rep;
676 vector<bool> repsource {false, false, true};
677 rep[AttrName] = repsource;
678 vector<bool> repout = rep[AttrName];
679 vector<bool> repout2;
680 repout2 = rep[AttrName];
682 EXPECT_EQ(repsource, repout);
683 EXPECT_EQ(repsource, repout2);
686 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
688 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
693 TEST(OCRepresentationSubscript, BooleanVectorVector)
695 static const std::string AttrName = "VectorTest";
696 OCRepresentation rep;
697 vector<vector<bool>> repsource {{true, true},{false, true}};
698 rep[AttrName] = repsource;
699 vector<vector<bool>> repout = rep[AttrName];
700 vector<vector<bool>> repout2;
701 repout2 = rep[AttrName];
703 EXPECT_EQ(repsource, repout);
704 EXPECT_EQ(repsource, repout2);
707 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
709 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
714 TEST(OCRepresentationSubscript, BooleanVectorVectorVector)
716 static const std::string AttrName = "VectorTest";
717 OCRepresentation rep;
718 vector<vector<vector<bool>>> repsource {{{true, true, false},{true}},
719 {{true, false, false},{false, true, true}}};
720 rep[AttrName] = repsource;
721 vector<vector<vector<bool>>> repout = rep[AttrName];
722 vector<vector<vector<bool>>> repout2;
723 repout2 = rep[AttrName];
725 EXPECT_EQ(repsource, repout);
726 EXPECT_EQ(repsource, repout2);
729 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
731 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
736 TEST(OCRepresentationSubscript, StringVector)
738 static const std::string AttrName = "VectorTest";
739 OCRepresentation rep;
740 vector<string> repsource {"str1", "str2"};
741 rep[AttrName] = repsource;
742 vector<string> repout = rep[AttrName];
743 vector<string> repout2;
744 repout2 = rep[AttrName];
746 EXPECT_EQ(repsource, repout);
747 EXPECT_EQ(repsource, repout2);
750 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
752 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
757 TEST(OCRepresentationSubscript, StringVectorVector)
759 static const std::string AttrName = "VectorTest";
760 OCRepresentation rep;
761 vector<vector<string>> repsource {{"str1", "str2"},{"str3", "str4"}};
762 rep[AttrName] = repsource;
763 vector<vector<string>> repout = rep[AttrName];
764 vector<vector<string>> repout2;
765 repout2 = rep[AttrName];
767 EXPECT_EQ(repsource, repout);
768 EXPECT_EQ(repsource, repout2);
771 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
773 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
778 TEST(OCRepresentationSubscript, StringVectorVectorVector)
780 static const std::string AttrName = "VectorTest";
781 OCRepresentation rep;
782 vector<vector<vector<string>>> repsource {{{"str1", "str2"},{"str3", "str4"}},
783 {{"str5"},{"str6"}}};
784 rep[AttrName] = repsource;
785 vector<vector<vector<string>>> repout = rep[AttrName];
786 vector<vector<vector<string>>> repout2;
787 repout2 = rep[AttrName];
789 EXPECT_EQ(repsource, repout);
790 EXPECT_EQ(repsource, repout2);
793 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
795 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
800 TEST(OCRepresentationSubscript, SubRepresentationVector)
802 static const std::string AttrName = "VectorTest";
803 OCRepresentation rep;
804 OCRepresentation inner1, inner2;
805 inner1.setUri("inner1");
806 inner2.setUri("inner2");
807 vector<OCRepresentation> repsource {inner1, inner2};
808 rep[AttrName] = repsource;
809 vector<OCRepresentation> repout = rep[AttrName];
810 vector<OCRepresentation> repout2;
811 repout2 = rep[AttrName];
813 EXPECT_EQ(2u, repout.size());
814 EXPECT_EQ(inner1.getUri(), repout[0].getUri());
815 EXPECT_EQ(inner2.getUri(), repout[1].getUri());
816 EXPECT_EQ(2u, repout2.size());
817 EXPECT_EQ(inner1.getUri(), repout2[0].getUri());
818 EXPECT_EQ(inner2.getUri(), repout2[1].getUri());
821 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
823 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
828 TEST(OCRepresentationSubscript, SubRepresentationVectorVector)
830 static const std::string AttrName = "VectorTest";
831 OCRepresentation rep;
832 OCRepresentation inner1, inner2, inner3, inner4;
833 inner1.setUri("inner1");
834 inner2.setUri("inner2");
835 inner3.setUri("inner3");
836 inner4.setUri("inner4");
838 vector<vector<OCRepresentation>> repsource {{inner1, inner2}, {inner3, inner4}};
839 rep[AttrName] = repsource;
840 vector<vector<OCRepresentation>> repout = rep[AttrName];
841 vector<vector<OCRepresentation>> repout2;
842 repout2 = rep[AttrName];
844 EXPECT_EQ(2u, repout.size());
845 EXPECT_EQ(2u, repout[0].size());
846 EXPECT_EQ(inner1.getUri(), repout[0][0].getUri());
847 EXPECT_EQ(inner2.getUri(), repout[0][1].getUri());
848 EXPECT_EQ(2u, repout.size());
849 EXPECT_EQ(2u, repout[1].size());
850 EXPECT_EQ(inner3.getUri(), repout[1][0].getUri());
851 EXPECT_EQ(inner4.getUri(), repout[1][1].getUri());
853 EXPECT_EQ(2u, repout2.size());
854 EXPECT_EQ(2u, repout2[0].size());
855 EXPECT_EQ(inner1.getUri(), repout2[0][0].getUri());
856 EXPECT_EQ(inner2.getUri(), repout2[0][1].getUri());
857 EXPECT_EQ(2u, repout2.size());
858 EXPECT_EQ(2u, repout2[1].size());
859 EXPECT_EQ(inner3.getUri(), repout2[1][0].getUri());
860 EXPECT_EQ(inner4.getUri(), repout2[1][1].getUri());
863 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
865 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
870 TEST(OCRepresentationSubscript, SubRepresentationVectorVectorVector)
872 static const std::string AttrName = "VectorTest";
873 OCRepresentation rep;
874 OCRepresentation inner1, inner2, inner3, inner4, inner5, inner6, inner7, inner8;
875 inner1.setUri("inner1");
876 inner2.setUri("inner2");
877 inner3.setUri("inner3");
878 inner4.setUri("inner4");
879 inner5.setUri("inner5");
880 inner6.setUri("inner6");
881 inner7.setUri("inner7");
882 inner8.setUri("inner8");
884 vector<vector<vector<OCRepresentation>>> repsource
885 {{{inner1, inner2},{inner3, inner4}},{{inner5, inner6},{inner7,inner8}}};
887 rep[AttrName] = repsource;
888 vector<vector<vector<OCRepresentation>>> repout = rep[AttrName];
889 vector<vector<vector<OCRepresentation>>> repout2;
890 repout2 = rep[AttrName];
892 EXPECT_EQ(2u, repout.size());
893 EXPECT_EQ(2u, repout[0].size());
894 EXPECT_EQ(2u, repout[0][0].size());
895 EXPECT_EQ(inner1.getUri(), repout[0][0][0].getUri());
896 EXPECT_EQ(inner2.getUri(), repout[0][0][1].getUri());
897 EXPECT_EQ(2u, repout[0][1].size());
898 EXPECT_EQ(inner3.getUri(), repout[0][1][0].getUri());
899 EXPECT_EQ(inner4.getUri(), repout[0][1][1].getUri());
900 EXPECT_EQ(2u, repout[1].size());
901 EXPECT_EQ(2u, repout[1][0].size());
902 EXPECT_EQ(inner5.getUri(), repout[1][0][0].getUri());
903 EXPECT_EQ(inner6.getUri(), repout[1][0][1].getUri());
904 EXPECT_EQ(2u, repout[1][1].size());
905 EXPECT_EQ(inner7.getUri(), repout[1][1][0].getUri());
906 EXPECT_EQ(inner8.getUri(), repout[1][1][1].getUri());
908 EXPECT_EQ(2u, repout2.size());
909 EXPECT_EQ(2u, repout2[0].size());
910 EXPECT_EQ(2u, repout2[0][0].size());
911 EXPECT_EQ(inner1.getUri(), repout2[0][0][0].getUri());
912 EXPECT_EQ(inner2.getUri(), repout2[0][0][1].getUri());
913 EXPECT_EQ(2u, repout[0][1].size());
914 EXPECT_EQ(inner3.getUri(), repout2[0][1][0].getUri());
915 EXPECT_EQ(inner4.getUri(), repout2[0][1][1].getUri());
916 EXPECT_EQ(2u, repout[1].size());
917 EXPECT_EQ(2u, repout[1][0].size());
918 EXPECT_EQ(inner5.getUri(), repout2[1][0][0].getUri());
919 EXPECT_EQ(inner6.getUri(), repout2[1][0][1].getUri());
920 EXPECT_EQ(2u, repout[1][1].size());
921 EXPECT_EQ(inner7.getUri(), repout2[1][1][0].getUri());
922 EXPECT_EQ(inner8.getUri(), repout2[1][1][1].getUri());
925 EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
927 EXPECT_FALSE(rep.getValue<string>(AttrName, badoutstr));
932 TEST(OCRepresentationIterator, constiterator)
934 OCRepresentation rep;
936 EXPECT_TRUE(rep.empty());
937 rep.setValue("int", 8);
938 EXPECT_FALSE(rep.empty());
939 rep.setValue("double", 8.8);
940 rep.setValue("bool", true);
941 rep.setValue("string", std::string("this is a string"));
943 EXPECT_EQ(4u, rep.size());
944 EXPECT_FALSE(rep.empty());
946 OCRepresentation::const_iterator itr = rep.cbegin();
947 OCRepresentation::const_iterator endItr = rep.cend();
948 for(;itr!=endItr;++itr);
950 const OCRepresentation& rep2(rep);
951 OCRepresentation::const_iterator itr2 = rep2.begin();
952 OCRepresentation::const_iterator endItr2 = rep2.end();
953 for(;itr2!=endItr2;++itr2);
957 TEST(OCRepresentationIterator, constautoiterator)
959 OCRepresentation rep;
961 EXPECT_TRUE(rep.empty());
962 rep.setValue("int", 8);
963 EXPECT_FALSE(rep.empty());
964 rep.setValue("double", 8.8);
965 rep.setValue("bool", true);
966 rep.setValue("string", std::string("this is a string"));
968 EXPECT_EQ(4u, rep.size());
969 EXPECT_FALSE(rep.empty());
971 for(const auto& a : rep)
976 const OCRepresentation& rep2(rep);
977 for(const auto& a : rep2)
982 TEST(OCRepresentationIterator, autoiterator)
984 OCRepresentation rep;
986 EXPECT_TRUE(rep.empty());
987 rep.setValue("int", 8);
988 EXPECT_FALSE(rep.empty());
989 rep.setValue("double", 8.8);
990 rep.setValue("bool", true);
991 rep.setValue("string", std::string("this is a string"));
993 EXPECT_EQ(4u, rep.size());
994 EXPECT_FALSE(rep.empty());
998 if(cur.attrname() == "int")
1000 EXPECT_EQ("int", cur.attrname());
1001 EXPECT_EQ(AttributeType::Integer, cur.type());
1002 EXPECT_EQ(AttributeType::Integer, cur.base_type());
1003 EXPECT_EQ(0u, cur.depth());
1004 int curInt = cur.getValue<int>();
1005 EXPECT_EQ(8, curInt);
1007 if(cur.attrname() == "double")
1009 EXPECT_EQ("double", cur.attrname());
1010 EXPECT_EQ(AttributeType::Double, cur.type());
1011 EXPECT_EQ(AttributeType::Double, cur.base_type());
1012 EXPECT_EQ(0u, cur.depth());
1013 double curDouble = cur.getValue<double>();
1014 EXPECT_EQ(8.8, curDouble);
1016 if(cur.attrname() == "bool")
1018 EXPECT_EQ("bool", cur.attrname());
1019 EXPECT_EQ(AttributeType::Boolean, cur.type());
1020 EXPECT_EQ(AttributeType::Boolean, cur.base_type());
1021 EXPECT_EQ(0u, cur.depth());
1022 bool curBool = cur.getValue<bool>();
1023 EXPECT_EQ(true, curBool);
1025 if(cur.attrname() == "string")
1027 EXPECT_EQ("string", cur.attrname());
1028 EXPECT_EQ(AttributeType::String, cur.type());
1029 EXPECT_EQ(AttributeType::String, cur.base_type());
1030 EXPECT_EQ(0u, cur.depth());
1031 string curStr = cur.getValue<string>();
1032 EXPECT_EQ("this is a string", curStr);
1037 TEST(OCRepresentationIterator, iterator)
1039 OCRepresentation rep;
1040 OCRepresentation sub1;
1041 sub1.setUri("sub rep1 URI");
1042 OCRepresentation sub2;
1043 sub2.setUri("sub rep2 URI");
1044 OCRepresentation sub3;
1045 sub3.setUri("sub rep3 URI");
1046 OCRepresentation sub4;
1047 sub4.setUri("sub rep4 URI");
1048 OCRepresentation sub5;
1049 sub5.setUri("sub rep5 URI");
1050 OCRepresentation sub6;
1051 sub6.setUri("sub rep6 URI");
1054 EXPECT_TRUE(rep.empty());
1055 rep.setValue("int", 8);
1056 EXPECT_FALSE(rep.empty());
1057 rep.setValue("double", 8.8);
1058 rep.setValue("bool", true);
1059 rep.setValue("string", std::string("this is a string"));
1060 rep.setValue("rep", sub1);
1062 vector<int> intv {1,2,3,4};
1063 rep.setValue("intv", intv);
1064 vector<double> doublev {1.1,2.2,3.3,4.4};
1065 rep.setValue("doublev", doublev);
1066 vector<bool> boolv{false, false, true};
1067 rep.setValue("boolv", boolv);
1068 vector<string> strv{"abc", "def", "ghi"};
1069 rep.setValue("strv", strv);
1070 vector<OCRepresentation> repv { sub1, sub2 };
1071 rep.setValue("repv", repv);
1073 vector<vector<int>> intvv{{1,2,3},{4,5,6}};
1074 rep.setValue("intvv", intvv);
1075 vector<vector<vector<int>>> intvvv{{{1,2},{3,4}},{{5,6},{8,7}}};
1076 rep.setValue("intvvv", intvvv);
1078 vector<vector<double>> doublevv{{1.1,2.1,3},{4.4,5.4,6.4}};
1079 rep.setValue("doublevv", doublevv);
1080 vector<vector<vector<double>>> doublevvv{{{1.1,2.1},{3.1,4.1}},{{5.1,6.1},{8.1,7.1}}};
1081 rep.setValue("doublevvv", doublevvv);
1083 vector<vector<bool>> boolvv{{false, true},{true, false}};
1084 rep.setValue("boolvv", boolvv);
1085 vector<vector<vector<bool>>> boolvvv{{{true, false},{true}},{{false},{true}}};
1086 rep.setValue("boolvvv", boolvvv);
1088 vector<vector<string>> strvv{{"abc", "def"},{"wer", "qwer"}};
1089 rep.setValue("strvv", strvv);
1090 vector<vector<vector<string>>> strvvv{{{"wqr", "xcv"},{"234"}},{{"we"},{"wert"}}};
1091 rep.setValue("strvvv", strvvv);
1093 vector<vector<OCRepresentation>> repvv{{sub1, sub2},{sub3, sub4}};
1094 rep.setValue("repvv", repvv);
1095 vector<vector<vector<OCRepresentation>>> repvvv{{{sub5},{sub6}},{{sub3},{sub2}}};
1096 rep.setValue("repvvv", repvvv);
1098 EXPECT_EQ(20u, rep.size());
1099 EXPECT_FALSE(rep.empty());
1101 OCRepresentation::iterator itr= rep.begin();
1102 OCRepresentation::iterator endItr = rep.end();
1104 for(;itr!=endItr;++itr)
1106 if(itr->attrname() == "int")
1108 EXPECT_EQ("int", itr->attrname());
1109 EXPECT_EQ(AttributeType::Integer, itr->type());
1110 EXPECT_EQ(AttributeType::Integer, itr->base_type());
1111 EXPECT_EQ(0u, itr->depth());
1112 int curInt = (*itr).getValue<int>();
1113 EXPECT_EQ(8, curInt);
1115 else if (itr->attrname() == "double")
1117 EXPECT_EQ("double", itr->attrname());
1118 EXPECT_EQ(AttributeType::Double, itr->type());
1119 EXPECT_EQ(AttributeType::Double, itr->base_type());
1120 EXPECT_EQ(0u, itr->depth());
1121 double curDouble = (*itr).getValue<double>();
1122 EXPECT_EQ(8.8, curDouble);
1124 else if (itr->attrname() == "bool")
1126 EXPECT_EQ("bool", itr->attrname());
1127 EXPECT_EQ(AttributeType::Boolean, itr->type());
1128 EXPECT_EQ(AttributeType::Boolean, itr->base_type());
1129 EXPECT_EQ(0u, itr->depth());
1130 bool curBool = (*itr).getValue<bool>();
1131 EXPECT_EQ(true, curBool);
1133 else if (itr->attrname() == "string")
1135 EXPECT_EQ("string", itr->attrname());
1136 EXPECT_EQ(AttributeType::String, itr->type());
1137 EXPECT_EQ(AttributeType::String, itr->base_type());
1138 EXPECT_EQ(0u, itr->depth());
1139 string curString = (*itr).getValue<string>();
1140 EXPECT_EQ("this is a string", curString);
1142 else if (itr->attrname() == "rep")
1144 EXPECT_EQ("rep", itr->attrname());
1145 EXPECT_EQ(AttributeType::OCRepresentation, itr->type());
1146 EXPECT_EQ(AttributeType::OCRepresentation, itr->base_type());
1147 EXPECT_EQ(0u, itr->depth());
1148 OCRepresentation curRep = (*itr).getValue<OCRepresentation>();
1149 EXPECT_EQ(sub1.getUri(), curRep.getUri());
1151 else if (itr->attrname() == "intv")
1153 EXPECT_EQ("intv", itr->attrname());
1154 EXPECT_EQ(AttributeType::Vector, itr->type());
1155 EXPECT_EQ(AttributeType::Integer, itr->base_type());
1156 EXPECT_EQ(1u, itr->depth());
1157 vector<int> curv = (*itr).getValue<vector<int>>();
1158 EXPECT_EQ(intv, curv);
1160 else if (itr->attrname() == "doublev")
1162 EXPECT_EQ("doublev", itr->attrname());
1163 EXPECT_EQ(AttributeType::Vector, itr->type());
1164 EXPECT_EQ(AttributeType::Double, itr->base_type());
1165 EXPECT_EQ(1u, itr->depth());
1166 vector<double> curv = (*itr).getValue<vector<double>>();
1167 EXPECT_EQ(doublev, curv);
1169 else if (itr->attrname() == "boolv")
1171 EXPECT_EQ("boolv", itr->attrname());
1172 EXPECT_EQ(AttributeType::Vector, itr->type());
1173 EXPECT_EQ(AttributeType::Boolean, itr->base_type());
1174 EXPECT_EQ(1u, itr->depth());
1175 vector<bool> curv = (*itr).getValue<vector<bool>>();
1176 EXPECT_EQ(boolv, curv);
1178 else if (itr->attrname() == "strv")
1180 EXPECT_EQ("strv", itr->attrname());
1181 EXPECT_EQ(AttributeType::Vector, itr->type());
1182 EXPECT_EQ(AttributeType::String, itr->base_type());
1183 EXPECT_EQ(1u, itr->depth());
1184 vector<string> curv = (*itr).getValue<vector<string>>();
1185 EXPECT_EQ(strv, curv);
1187 else if (itr->attrname() == "repv")
1189 EXPECT_EQ("repv", itr->attrname());
1190 EXPECT_EQ(AttributeType::Vector, itr->type());
1191 EXPECT_EQ(AttributeType::OCRepresentation, itr->base_type());
1192 EXPECT_EQ(1u, itr->depth());
1193 vector<OCRepresentation> curv = (*itr).getValue<vector<OCRepresentation>>();
1194 EXPECT_EQ(2u, repv.size());
1195 EXPECT_EQ(sub1.getUri(), repv[0].getUri());
1196 EXPECT_EQ(sub2.getUri(), repv[1].getUri());
1198 else if (itr->attrname() == "intvv")
1200 EXPECT_EQ("intvv", itr->attrname());
1201 EXPECT_EQ(AttributeType::Vector, itr->type());
1202 EXPECT_EQ(AttributeType::Integer, itr->base_type());
1203 EXPECT_EQ(2u, itr->depth());
1204 vector<vector<int>> curv = (*itr).getValue<vector<vector<int>>>();
1205 EXPECT_EQ(intvv, curv);
1207 else if (itr->attrname() == "intvvv")
1209 EXPECT_EQ("intvvv", itr->attrname());
1210 EXPECT_EQ(AttributeType::Vector, itr->type());
1211 EXPECT_EQ(AttributeType::Integer, itr->base_type());
1212 EXPECT_EQ(3u, itr->depth());
1213 vector<vector<vector<int>>> curv = (*itr).getValue<vector<vector<vector<int>>>>();
1214 EXPECT_EQ(intvvv, curv);
1216 else if (itr->attrname() == "doublevv")
1218 EXPECT_EQ("doublevv", itr->attrname());
1219 EXPECT_EQ(AttributeType::Vector, itr->type());
1220 EXPECT_EQ(AttributeType::Double, itr->base_type());
1221 EXPECT_EQ(2u, itr->depth());
1222 vector<vector<double>> curv = (*itr).getValue<vector<vector<double>>>();
1223 EXPECT_EQ(doublevv, curv);
1225 else if (itr->attrname() == "doublevvv")
1227 EXPECT_EQ("doublevvv", itr->attrname());
1228 EXPECT_EQ(AttributeType::Vector, itr->type());
1229 EXPECT_EQ(AttributeType::Double, itr->base_type());
1230 EXPECT_EQ(3u, itr->depth());
1231 vector<vector<vector<double>>> curv =
1232 (*itr).getValue<vector<vector<vector<double>>>>();
1233 EXPECT_EQ(doublevvv, curv);
1235 else if (itr->attrname() == "boolvv")
1237 EXPECT_EQ("boolvv", itr->attrname());
1238 EXPECT_EQ(AttributeType::Vector, itr->type());
1239 EXPECT_EQ(AttributeType::Boolean, itr->base_type());
1240 EXPECT_EQ(2u, itr->depth());
1241 vector<vector<bool>> curv = (*itr).getValue<vector<vector<bool>>>();
1242 EXPECT_EQ(boolvv, curv);
1244 else if (itr->attrname() == "boolvvv")
1246 EXPECT_EQ("boolvvv", itr->attrname());
1247 EXPECT_EQ(AttributeType::Vector, itr->type());
1248 EXPECT_EQ(AttributeType::Boolean, itr->base_type());
1249 EXPECT_EQ(3u, itr->depth());
1250 vector<vector<vector<bool>>> curv = (*itr).getValue<vector<vector<vector<bool>>>>();
1251 EXPECT_EQ(boolvvv, curv);
1253 else if (itr->attrname() == "strvv")
1255 EXPECT_EQ("strvv", itr->attrname());
1256 EXPECT_EQ(AttributeType::Vector, itr->type());
1257 EXPECT_EQ(AttributeType::String, itr->base_type());
1258 EXPECT_EQ(2u, itr->depth());
1259 vector<vector<string>> curv = (*itr).getValue<vector<vector<string>>>();
1260 EXPECT_EQ(strvv, curv);
1262 else if (itr->attrname() == "strvvv")
1264 EXPECT_EQ("strvvv", itr->attrname());
1265 EXPECT_EQ(AttributeType::Vector, itr->type());
1266 EXPECT_EQ(AttributeType::String, itr->base_type());
1267 EXPECT_EQ(3u, itr->depth());
1268 vector<vector<vector<string>>> curv =
1269 (*itr).getValue<vector<vector<vector<string>>>>();
1270 EXPECT_EQ(strvvv, curv);
1272 else if (itr->attrname() == "repvv")
1274 EXPECT_EQ("repvv", itr->attrname());
1275 EXPECT_EQ(AttributeType::Vector, itr->type());
1276 EXPECT_EQ(AttributeType::OCRepresentation, itr->base_type());
1277 EXPECT_EQ(2u, itr->depth());
1278 vector<vector<OCRepresentation>> curv =
1279 (*itr).getValue<vector<vector<OCRepresentation>>>();
1280 EXPECT_EQ(2u, curv.size());
1281 EXPECT_EQ(2u, curv[0].size());
1282 EXPECT_EQ(sub1.getUri(), curv[0][0].getUri());
1283 EXPECT_EQ(sub2.getUri(), curv[0][1].getUri());
1284 EXPECT_EQ(2u, curv[1].size());
1285 EXPECT_EQ(sub3.getUri(), curv[1][0].getUri());
1286 EXPECT_EQ(sub4.getUri(), curv[1][1].getUri());
1288 else if (itr->attrname() == "repvvv")
1290 EXPECT_EQ("repvvv", itr->attrname());
1291 EXPECT_EQ(AttributeType::Vector, itr->type());
1292 EXPECT_EQ(AttributeType::OCRepresentation, itr->base_type());
1293 EXPECT_EQ(3u, itr->depth());
1294 vector<vector<vector<OCRepresentation>>> curv =
1295 (*itr).getValue<vector<vector<vector<OCRepresentation>>>>();
1296 EXPECT_EQ(2u, curv.size());
1297 EXPECT_EQ(2u, curv[0].size());
1298 EXPECT_EQ(1u, curv[0][0].size());
1299 EXPECT_EQ(sub5.getUri(), curv[0][0][0].getUri());
1300 EXPECT_EQ(1u, curv[0][1].size());
1301 EXPECT_EQ(sub6.getUri(), curv[0][1][0].getUri());
1302 EXPECT_EQ(1u, curv[1][0].size());
1303 EXPECT_EQ(sub3.getUri(), curv[1][0][0].getUri());
1304 EXPECT_EQ(1u, curv[1][1].size());
1305 EXPECT_EQ(sub2.getUri(), curv[1][1][0].getUri());
1309 EXPECT_TRUE(false) << itr->attrname();