am fc427ee2: Android APK build with parametrized build root dir automerge: baf29b3
[platform/upstream/VK-GL-CTS.git] / modules / internal / ditFrameworkTests.cpp
1 /*-------------------------------------------------------------------------
2  * drawElements Internal Test Module
3  * ---------------------------------
4  *
5  * Copyright 2014 The Android Open Source Project
6  *
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  *//*!
20  * \file
21  * \brief Miscellaneous framework tests.
22  *//*--------------------------------------------------------------------*/
23
24 #include "ditFrameworkTests.hpp"
25 #include "tcuFloatFormat.hpp"
26 #include "tcuTestLog.hpp"
27 #include "tcuCommandLine.hpp"
28
29 namespace dit
30 {
31
32 namespace
33 {
34
35 using std::string;
36 using std::vector;
37 using tcu::TestLog;
38
39 struct MatchCase
40 {
41         enum Expected { NO_MATCH, MATCH_GROUP, MATCH_CASE, EXPECTED_LAST };
42
43         const char*     path;
44         Expected        expected;
45 };
46
47 const char* getMatchCaseExpectedDesc (MatchCase::Expected expected)
48 {
49         static const char* descs[] =
50         {
51                 "no match",
52                 "group to match",
53                 "case to match"
54         };
55         return de::getSizedArrayElement<MatchCase::EXPECTED_LAST>(descs, expected);
56 }
57
58 class CaseListParserCase : public tcu::TestCase
59 {
60 public:
61         CaseListParserCase (tcu::TestContext& testCtx, const char* name, const char* caseList, const MatchCase* subCases, int numSubCases)
62                 : tcu::TestCase (testCtx, name, "")
63                 , m_caseList    (caseList)
64                 , m_subCases    (subCases)
65                 , m_numSubCases (numSubCases)
66         {
67         }
68
69         IterateResult iterate (void)
70         {
71                 TestLog&                        log             = m_testCtx.getLog();
72                 tcu::CommandLine        cmdLine;
73                 int                                     numPass = 0;
74
75                 log << TestLog::Message << "Input:\n\"" << m_caseList << "\"" << TestLog::EndMessage;
76
77                 {
78                         const char* argv[] =
79                         {
80                                 "deqp",
81                                 "--deqp-caselist",
82                                 m_caseList
83                         };
84
85                         if (!cmdLine.parse(DE_LENGTH_OF_ARRAY(argv), argv))
86                                 TCU_FAIL("Failed to parse case list");
87                 }
88
89                 for (int subCaseNdx = 0; subCaseNdx < m_numSubCases; subCaseNdx++)
90                 {
91                         const MatchCase&        curCase         = m_subCases[subCaseNdx];
92                         bool                            matchGroup;
93                         bool                            matchCase;
94
95                         log << TestLog::Message << "Checking \"" << curCase.path << "\""
96                                                                         << ", expecting " << getMatchCaseExpectedDesc(curCase.expected)
97                                 << TestLog::EndMessage;
98
99                         matchGroup      = cmdLine.checkTestGroupName(curCase.path);
100                         matchCase       = cmdLine.checkTestCaseName(curCase.path);
101
102                         if ((matchGroup == (curCase.expected == MatchCase::MATCH_GROUP)) &&
103                                 (matchCase      == (curCase.expected == MatchCase::MATCH_CASE)))
104                         {
105                                 log << TestLog::Message << "   pass" << TestLog::EndMessage;
106                                 numPass += 1;
107                         }
108                         else
109                                 log << TestLog::Message << "   FAIL!" << TestLog::EndMessage;
110                 }
111
112                 m_testCtx.setTestResult((numPass == m_numSubCases) ? QP_TEST_RESULT_PASS        : QP_TEST_RESULT_FAIL,
113                                                                 (numPass == m_numSubCases) ? "All passed"                       : "Unexpected match result");
114
115                 return STOP;
116         }
117
118 private:
119         const char* const                       m_caseList;
120         const MatchCase* const          m_subCases;
121         const int                                       m_numSubCases;
122 };
123
124 class NegativeCaseListCase : public tcu::TestCase
125 {
126 public:
127         NegativeCaseListCase (tcu::TestContext& testCtx, const char* name, const char* caseList)
128                 : tcu::TestCase (testCtx, name, "")
129                 , m_caseList    (caseList)
130         {
131         }
132
133         IterateResult iterate (void)
134         {
135                 TestLog&                        log             = m_testCtx.getLog();
136                 tcu::CommandLine        cmdLine;
137
138                 log << TestLog::Message << "Input:\n\"" << m_caseList << "\"" << TestLog::EndMessage;
139
140                 {
141                         const char* argv[] =
142                         {
143                                 "deqp",
144                                 "--deqp-caselist",
145                                 m_caseList
146                         };
147
148                         if (cmdLine.parse(DE_LENGTH_OF_ARRAY(argv), argv))
149                                 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Parsing passed, should have failed");
150                         else
151                                 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Parsing failed as expected");
152                 }
153
154                 return STOP;
155         }
156
157 private:
158         const char* const       m_caseList;
159 };
160
161 class TrieParserTests : public tcu::TestCaseGroup
162 {
163 public:
164         TrieParserTests (tcu::TestContext& testCtx)
165                 : tcu::TestCaseGroup(testCtx, "trie", "Test case trie parser tests")
166         {
167         }
168
169         void init (void)
170         {
171                 {
172                         static const char* const        caseList        = "{test}";
173                         static const MatchCase          subCases[]      =
174                         {
175                                 { "test",               MatchCase::MATCH_CASE   },
176                                 { "test.cd",    MatchCase::NO_MATCH             },
177                         };
178                         addChild(new CaseListParserCase(m_testCtx, "single_case", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
179                 }
180                 {
181                         static const char* const        caseList        = "{a{b}}";
182                         static const MatchCase          subCases[]      =
183                         {
184                                 { "a",          MatchCase::MATCH_GROUP  },
185                                 { "b",          MatchCase::NO_MATCH             },
186                                 { "a.b",        MatchCase::MATCH_CASE   },
187                                 { "a.a",        MatchCase::NO_MATCH             },
188                         };
189                         addChild(new CaseListParserCase(m_testCtx, "simple_group_1", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
190                 }
191                 {
192                         static const char* const        caseList        = "{a{b,c}}";
193                         static const MatchCase          subCases[]      =
194                         {
195                                 { "a",          MatchCase::MATCH_GROUP  },
196                                 { "b",          MatchCase::NO_MATCH             },
197                                 { "a.b",        MatchCase::MATCH_CASE   },
198                                 { "a.a",        MatchCase::NO_MATCH             },
199                                 { "a.c",        MatchCase::MATCH_CASE   },
200                         };
201                         addChild(new CaseListParserCase(m_testCtx, "simple_group_2", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
202                 }
203                 {
204                         static const char* const        caseList        = "{a{b},c{d,e}}";
205                         static const MatchCase          subCases[]      =
206                         {
207                                 { "a",          MatchCase::MATCH_GROUP  },
208                                 { "b",          MatchCase::NO_MATCH             },
209                                 { "a.b",        MatchCase::MATCH_CASE   },
210                                 { "a.c",        MatchCase::NO_MATCH             },
211                                 { "a.d",        MatchCase::NO_MATCH             },
212                                 { "a.e",        MatchCase::NO_MATCH             },
213                                 { "c",          MatchCase::MATCH_GROUP  },
214                                 { "c.b",        MatchCase::NO_MATCH             },
215                                 { "c.d",        MatchCase::MATCH_CASE   },
216                                 { "c.e",        MatchCase::MATCH_CASE   },
217                         };
218                         addChild(new CaseListParserCase(m_testCtx, "two_groups", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
219                 }
220                 {
221                         static const char* const        caseList        = "{a,c{d,e}}";
222                         static const MatchCase          subCases[]      =
223                         {
224                                 { "a",          MatchCase::MATCH_CASE   },
225                                 { "b",          MatchCase::NO_MATCH             },
226                                 { "a.b",        MatchCase::NO_MATCH             },
227                                 { "a.c",        MatchCase::NO_MATCH             },
228                                 { "a.d",        MatchCase::NO_MATCH             },
229                                 { "a.e",        MatchCase::NO_MATCH             },
230                                 { "c",          MatchCase::MATCH_GROUP  },
231                                 { "c.b",        MatchCase::NO_MATCH             },
232                                 { "c.d",        MatchCase::MATCH_CASE   },
233                                 { "c.e",        MatchCase::MATCH_CASE   },
234                         };
235                         addChild(new CaseListParserCase(m_testCtx, "case_group", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
236                 }
237                 {
238                         static const char* const        caseList        = "{c{d,e},a}";
239                         static const MatchCase          subCases[]      =
240                         {
241                                 { "a",          MatchCase::MATCH_CASE   },
242                                 { "b",          MatchCase::NO_MATCH             },
243                                 { "a.b",        MatchCase::NO_MATCH             },
244                                 { "a.c",        MatchCase::NO_MATCH             },
245                                 { "a.d",        MatchCase::NO_MATCH             },
246                                 { "a.e",        MatchCase::NO_MATCH             },
247                                 { "c",          MatchCase::MATCH_GROUP  },
248                                 { "c.b",        MatchCase::NO_MATCH             },
249                                 { "c.d",        MatchCase::MATCH_CASE   },
250                                 { "c.e",        MatchCase::MATCH_CASE   },
251                         };
252                         addChild(new CaseListParserCase(m_testCtx, "group_case", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
253                 }
254                 {
255                         static const char* const        caseList        = "{test}\r";
256                         static const MatchCase          subCases[]      =
257                         {
258                                 { "test",               MatchCase::MATCH_CASE   },
259                                 { "test.cd",    MatchCase::NO_MATCH             },
260                         };
261                         addChild(new CaseListParserCase(m_testCtx, "trailing_cr", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
262                 }
263                 {
264                         static const char* const        caseList        = "{test}\n";
265                         static const MatchCase          subCases[]      =
266                         {
267                                 { "test",               MatchCase::MATCH_CASE   },
268                                 { "test.cd",    MatchCase::NO_MATCH             },
269                         };
270                         addChild(new CaseListParserCase(m_testCtx, "trailing_lf", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
271                 }
272                 {
273                         static const char* const        caseList        = "{test}\r\n";
274                         static const MatchCase          subCases[]      =
275                         {
276                                 { "test",               MatchCase::MATCH_CASE   },
277                                 { "test.cd",    MatchCase::NO_MATCH             },
278                         };
279                         addChild(new CaseListParserCase(m_testCtx, "trailing_crlf", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
280                 }
281
282                 // Negative tests
283                 addChild(new NegativeCaseListCase(m_testCtx, "empty_string",                    ""));
284                 addChild(new NegativeCaseListCase(m_testCtx, "empty_line",                              "\n"));
285                 addChild(new NegativeCaseListCase(m_testCtx, "empty_root",                              "{}"));
286                 addChild(new NegativeCaseListCase(m_testCtx, "empty_group",                             "{test{}}"));
287                 addChild(new NegativeCaseListCase(m_testCtx, "empty_group_name_1",              "{{}}"));
288                 addChild(new NegativeCaseListCase(m_testCtx, "empty_group_name_2",              "{{test}}"));
289                 addChild(new NegativeCaseListCase(m_testCtx, "unterminated_root_1",             "{"));
290                 addChild(new NegativeCaseListCase(m_testCtx, "unterminated_root_2",             "{test"));
291                 addChild(new NegativeCaseListCase(m_testCtx, "unterminated_root_3",             "{test,"));
292                 addChild(new NegativeCaseListCase(m_testCtx, "unterminated_root_4",             "{test{a}"));
293                 addChild(new NegativeCaseListCase(m_testCtx, "unterminated_root_5",             "{a,b"));
294                 addChild(new NegativeCaseListCase(m_testCtx, "unterminated_group_1",    "{test{"));
295                 addChild(new NegativeCaseListCase(m_testCtx, "unterminated_group_2",    "{test{a"));
296                 addChild(new NegativeCaseListCase(m_testCtx, "unterminated_group_3",    "{test{a,"));
297                 addChild(new NegativeCaseListCase(m_testCtx, "unterminated_group_4",    "{test{a,b"));
298                 addChild(new NegativeCaseListCase(m_testCtx, "empty_case_name_1",               "{a,,b}"));
299                 addChild(new NegativeCaseListCase(m_testCtx, "empty_case_name_2",               "{,b}"));
300                 addChild(new NegativeCaseListCase(m_testCtx, "empty_case_name_3",               "{a,}"));
301                 addChild(new NegativeCaseListCase(m_testCtx, "no_separator",                    "{a{b}c}"));
302                 addChild(new NegativeCaseListCase(m_testCtx, "invalid_char_1",                  "{a.b}"));
303                 addChild(new NegativeCaseListCase(m_testCtx, "invalid_char_2",                  "{a[]}"));
304                 addChild(new NegativeCaseListCase(m_testCtx, "trailing_char_1",                 "{a}}"));
305                 addChild(new NegativeCaseListCase(m_testCtx, "trailing_char_2",                 "{a}x"));
306                 addChild(new NegativeCaseListCase(m_testCtx, "embedded_newline_1",              "{\na}"));
307                 addChild(new NegativeCaseListCase(m_testCtx, "embedded_newline_2",              "{a\n,b}"));
308                 addChild(new NegativeCaseListCase(m_testCtx, "embedded_newline_3",              "{a,\nb}"));
309                 addChild(new NegativeCaseListCase(m_testCtx, "embedded_newline_4",              "{a{b\n}}"));
310                 addChild(new NegativeCaseListCase(m_testCtx, "embedded_newline_5",              "{a{b}\n}"));
311         }
312 };
313
314 class ListParserTests : public tcu::TestCaseGroup
315 {
316 public:
317         ListParserTests (tcu::TestContext& testCtx)
318                 : tcu::TestCaseGroup(testCtx, "list", "Test case list parser tests")
319         {
320         }
321
322         void init (void)
323         {
324                 {
325                         static const char* const        caseList        = "test";
326                         static const MatchCase          subCases[]      =
327                         {
328                                 { "test",               MatchCase::MATCH_CASE   },
329                                 { "test.cd",    MatchCase::NO_MATCH             },
330                         };
331                         addChild(new CaseListParserCase(m_testCtx, "single_case", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
332                 }
333                 {
334                         static const char* const        caseList        = "a.b";
335                         static const MatchCase          subCases[]      =
336                         {
337                                 { "a",          MatchCase::MATCH_GROUP  },
338                                 { "b",          MatchCase::NO_MATCH             },
339                                 { "a.b",        MatchCase::MATCH_CASE   },
340                                 { "a.a",        MatchCase::NO_MATCH             },
341                         };
342                         addChild(new CaseListParserCase(m_testCtx, "simple_group_1", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
343                 }
344                 {
345                         static const char* const        caseList        = "a.b\na.c";
346                         static const MatchCase          subCases[]      =
347                         {
348                                 { "a",          MatchCase::MATCH_GROUP  },
349                                 { "b",          MatchCase::NO_MATCH             },
350                                 { "a.b",        MatchCase::MATCH_CASE   },
351                                 { "a.a",        MatchCase::NO_MATCH             },
352                                 { "a.c",        MatchCase::MATCH_CASE   },
353                         };
354                         addChild(new CaseListParserCase(m_testCtx, "simple_group_2", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
355                 }
356                 {
357                         static const char* const        caseList        = "a.b\na.c";
358                         static const MatchCase          subCases[]      =
359                         {
360                                 { "a",          MatchCase::MATCH_GROUP  },
361                                 { "b",          MatchCase::NO_MATCH             },
362                                 { "a.b",        MatchCase::MATCH_CASE   },
363                                 { "a.a",        MatchCase::NO_MATCH             },
364                                 { "a.c",        MatchCase::MATCH_CASE   },
365                         };
366                         addChild(new CaseListParserCase(m_testCtx, "separator_ln", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
367                 }
368                 {
369                         static const char* const        caseList        = "a.b\ra.c";
370                         static const MatchCase          subCases[]      =
371                         {
372                                 { "a",          MatchCase::MATCH_GROUP  },
373                                 { "b",          MatchCase::NO_MATCH             },
374                                 { "a.b",        MatchCase::MATCH_CASE   },
375                                 { "a.a",        MatchCase::NO_MATCH             },
376                                 { "a.c",        MatchCase::MATCH_CASE   },
377                         };
378                         addChild(new CaseListParserCase(m_testCtx, "separator_cr", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
379                 }
380                 {
381                         static const char* const        caseList        = "a.b\r\na.c";
382                         static const MatchCase          subCases[]      =
383                         {
384                                 { "a",          MatchCase::MATCH_GROUP  },
385                                 { "b",          MatchCase::NO_MATCH             },
386                                 { "a.b",        MatchCase::MATCH_CASE   },
387                                 { "a.a",        MatchCase::NO_MATCH             },
388                                 { "a.c",        MatchCase::MATCH_CASE   },
389                         };
390                         addChild(new CaseListParserCase(m_testCtx, "separator_crlf", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
391                 }
392                 {
393                         static const char* const        caseList        = "a.b\na.c\n";
394                         static const MatchCase          subCases[]      =
395                         {
396                                 { "a",          MatchCase::MATCH_GROUP  },
397                                 { "b",          MatchCase::NO_MATCH             },
398                                 { "a.b",        MatchCase::MATCH_CASE   },
399                                 { "a.a",        MatchCase::NO_MATCH             },
400                                 { "a.c",        MatchCase::MATCH_CASE   },
401                         };
402                         addChild(new CaseListParserCase(m_testCtx, "end_ln", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
403                 }
404                 {
405                         static const char* const        caseList        = "a.b\na.c\r";
406                         static const MatchCase          subCases[]      =
407                         {
408                                 { "a",          MatchCase::MATCH_GROUP  },
409                                 { "b",          MatchCase::NO_MATCH             },
410                                 { "a.b",        MatchCase::MATCH_CASE   },
411                                 { "a.a",        MatchCase::NO_MATCH             },
412                                 { "a.c",        MatchCase::MATCH_CASE   },
413                         };
414                         addChild(new CaseListParserCase(m_testCtx, "end_cr", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
415                 }
416                 {
417                         static const char* const        caseList        = "a.b\na.c\r\n";
418                         static const MatchCase          subCases[]      =
419                         {
420                                 { "a",          MatchCase::MATCH_GROUP  },
421                                 { "b",          MatchCase::NO_MATCH             },
422                                 { "a.b",        MatchCase::MATCH_CASE   },
423                                 { "a.a",        MatchCase::NO_MATCH             },
424                                 { "a.c",        MatchCase::MATCH_CASE   },
425                         };
426                         addChild(new CaseListParserCase(m_testCtx, "end_crlf", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
427                 }
428                 {
429                         static const char* const        caseList        = "a.b\nc.d\nc.e";
430                         static const MatchCase          subCases[]      =
431                         {
432                                 { "a",          MatchCase::MATCH_GROUP  },
433                                 { "b",          MatchCase::NO_MATCH             },
434                                 { "a.b",        MatchCase::MATCH_CASE   },
435                                 { "a.c",        MatchCase::NO_MATCH             },
436                                 { "a.d",        MatchCase::NO_MATCH             },
437                                 { "a.e",        MatchCase::NO_MATCH             },
438                                 { "c",          MatchCase::MATCH_GROUP  },
439                                 { "c.b",        MatchCase::NO_MATCH             },
440                                 { "c.d",        MatchCase::MATCH_CASE   },
441                                 { "c.e",        MatchCase::MATCH_CASE   },
442                         };
443                         addChild(new CaseListParserCase(m_testCtx, "two_groups", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
444                 }
445                 {
446                         static const char* const        caseList        = "a\nc.d\nc.e";
447                         static const MatchCase          subCases[]      =
448                         {
449                                 { "a",          MatchCase::MATCH_CASE   },
450                                 { "b",          MatchCase::NO_MATCH             },
451                                 { "a.b",        MatchCase::NO_MATCH             },
452                                 { "a.c",        MatchCase::NO_MATCH             },
453                                 { "a.d",        MatchCase::NO_MATCH             },
454                                 { "a.e",        MatchCase::NO_MATCH             },
455                                 { "c",          MatchCase::MATCH_GROUP  },
456                                 { "c.b",        MatchCase::NO_MATCH             },
457                                 { "c.d",        MatchCase::MATCH_CASE   },
458                                 { "c.e",        MatchCase::MATCH_CASE   },
459                         };
460                         addChild(new CaseListParserCase(m_testCtx, "case_group", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
461                 }
462                 {
463                         static const char* const        caseList        = "c.d\nc.e\na";
464                         static const MatchCase          subCases[]      =
465                         {
466                                 { "a",          MatchCase::MATCH_CASE   },
467                                 { "b",          MatchCase::NO_MATCH             },
468                                 { "a.b",        MatchCase::NO_MATCH             },
469                                 { "a.c",        MatchCase::NO_MATCH             },
470                                 { "a.d",        MatchCase::NO_MATCH             },
471                                 { "a.e",        MatchCase::NO_MATCH             },
472                                 { "c",          MatchCase::MATCH_GROUP  },
473                                 { "c.b",        MatchCase::NO_MATCH             },
474                                 { "c.d",        MatchCase::MATCH_CASE   },
475                                 { "c.e",        MatchCase::MATCH_CASE   },
476                         };
477                         addChild(new CaseListParserCase(m_testCtx, "group_case", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
478                 }
479                 {
480                         static const char* const        caseList        = "a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.x";
481                         static const MatchCase          subCases[]      =
482                         {
483                                 { "a",                                                                                          MatchCase::MATCH_GROUP  },
484                                 { "b",                                                                                          MatchCase::NO_MATCH             },
485                                 { "a.b",                                                                                        MatchCase::MATCH_GROUP  },
486                                 { "a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.x",      MatchCase::MATCH_CASE   },
487                         };
488                         addChild(new CaseListParserCase(m_testCtx, "long_name", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
489                 }
490                 {
491                         static const char* const        caseList        =
492                                 "a.b.c.d.e\n"
493                                 "a.b.c.f\n"
494                                 "x.y.z\n"
495                                 "a.b.c.d.g\n"
496                                 "a.b.c.x\n";
497                         static const MatchCase          subCases[]      =
498                         {
499                                 { "a",                          MatchCase::MATCH_GROUP  },
500                                 { "a.b",                        MatchCase::MATCH_GROUP  },
501                                 { "a.b.c.d.e",          MatchCase::MATCH_CASE   },
502                                 { "a.b.c.d.g",          MatchCase::MATCH_CASE   },
503                                 { "x.y",                        MatchCase::MATCH_GROUP  },
504                                 { "x.y.z",                      MatchCase::MATCH_CASE   },
505                                 { "a.b.c.f",            MatchCase::MATCH_CASE   },
506                                 { "a.b.c.x",            MatchCase::MATCH_CASE   },
507                         };
508                         addChild(new CaseListParserCase(m_testCtx, "partial_prefix", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
509                 }
510                 {
511                         static const char* const        caseList        =
512                                 "a.a.c.d\n"
513                                 "a.b.c.d\n";
514                         static const MatchCase          subCases[]      =
515                         {
516                                 { "a",                          MatchCase::MATCH_GROUP  },
517                                 { "a.a",                        MatchCase::MATCH_GROUP  },
518                                 { "a.b.c.d",            MatchCase::MATCH_CASE   },
519                                 { "a.b.c.d",            MatchCase::MATCH_CASE   },
520                         };
521                         addChild(new CaseListParserCase(m_testCtx, "reparenting", caseList, subCases, DE_LENGTH_OF_ARRAY(subCases)));
522                 }
523
524                 // Negative tests
525                 addChild(new NegativeCaseListCase(m_testCtx, "empty_string",                    ""));
526                 addChild(new NegativeCaseListCase(m_testCtx, "empty_line",                              "\n"));
527                 addChild(new NegativeCaseListCase(m_testCtx, "empty_group_name",                ".test"));
528                 addChild(new NegativeCaseListCase(m_testCtx, "empty_case_name",                 "test."));
529         }
530 };
531
532 class CaseListParserTests : public tcu::TestCaseGroup
533 {
534 public:
535         CaseListParserTests (tcu::TestContext& testCtx)
536                 : tcu::TestCaseGroup(testCtx, "case_list_parser", "Test case list parser tests")
537         {
538         }
539
540         void init (void)
541         {
542                 addChild(new TrieParserTests(m_testCtx));
543                 addChild(new ListParserTests(m_testCtx));
544         }
545 };
546
547 class CommonFrameworkTests : public tcu::TestCaseGroup
548 {
549 public:
550         CommonFrameworkTests (tcu::TestContext& testCtx)
551                 : tcu::TestCaseGroup(testCtx, "common", "Tests for the common utility framework")
552         {
553         }
554
555         void init (void)
556         {
557                 addChild(new SelfCheckCase(m_testCtx, "float_format","tcu::FloatFormat_selfTest()",
558                                                                    tcu::FloatFormat_selfTest));
559                 addChild(new CaseListParserTests(m_testCtx));
560         }
561 };
562
563 } // anonymous
564
565 FrameworkTests::FrameworkTests (tcu::TestContext& testCtx)
566         : tcu::TestCaseGroup(testCtx, "framework", "Miscellaneous framework tests")
567 {
568 }
569
570 FrameworkTests::~FrameworkTests (void)
571 {
572 }
573
574 void FrameworkTests::init (void)
575 {
576         addChild(new CommonFrameworkTests(m_testCtx));
577 }
578
579 }