1 #ifndef _VKTTESTGROUPUTIL_HPP
2 #define _VKTTESTGROUPUTIL_HPP
3 /*-------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2016 Google Inc.
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief TestCaseGroup utilities
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
32 class TestGroupHelper0 : public tcu::TestCaseGroup
35 typedef void (*CreateChildrenFunc) (tcu::TestCaseGroup* testGroup);
37 TestGroupHelper0 (tcu::TestContext& testCtx,
38 const std::string& name,
39 const std::string& description,
40 CreateChildrenFunc createChildren);
41 ~TestGroupHelper0 (void);
46 const CreateChildrenFunc m_createChildren;
49 template<typename Arg0>
50 class TestGroupHelper1 : public tcu::TestCaseGroup
53 typedef void (*CreateChildrenFunc) (tcu::TestCaseGroup* testGroup, Arg0 arg0);
55 TestGroupHelper1 (tcu::TestContext& testCtx,
56 const std::string& name,
57 const std::string& description,
58 CreateChildrenFunc createChildren,
60 : tcu::TestCaseGroup (testCtx, name.c_str(), description.c_str())
61 , m_createChildren (createChildren)
65 void init (void) { m_createChildren(this, m_arg0); }
68 const CreateChildrenFunc m_createChildren;
72 inline tcu::TestCaseGroup* createTestGroup (tcu::TestContext& testCtx,
73 const std::string& name,
74 const std::string& description,
75 TestGroupHelper0::CreateChildrenFunc createChildren)
77 return new TestGroupHelper0(testCtx, name, description, createChildren);
80 template<typename Arg0>
81 tcu::TestCaseGroup* createTestGroup (tcu::TestContext& testCtx,
82 const std::string& name,
83 const std::string& description,
84 typename TestGroupHelper1<Arg0>::CreateChildrenFunc createChildren,
87 return new TestGroupHelper1<Arg0>(testCtx, name, description, createChildren, arg0);
90 inline void addTestGroup (tcu::TestCaseGroup* parent,
91 const std::string& name,
92 const std::string& description,
93 TestGroupHelper0::CreateChildrenFunc createChildren)
95 parent->addChild(createTestGroup(parent->getTestContext(), name, description, createChildren));
98 template<typename Arg0>
99 void addTestGroup (tcu::TestCaseGroup* parent,
100 const std::string& name,
101 const std::string& description,
102 typename TestGroupHelper1<Arg0>::CreateChildrenFunc createChildren,
105 parent->addChild(createTestGroup<Arg0>(parent->getTestContext(), name, description, createChildren, arg0));
110 #endif // _VKTTESTGROUPUTIL_HPP