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