1 #ifndef _VKTTESTGROUPUTIL_HPP
2 #define _VKTTESTGROUPUTIL_HPP
3 /*-------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2016 Google Inc.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and/or associated documentation files (the
11 * "Materials"), to deal in the Materials without restriction, including
12 * without limitation the rights to use, copy, modify, merge, publish,
13 * distribute, sublicense, and/or sell copies of the Materials, and to
14 * permit persons to whom the Materials are furnished to do so, subject to
15 * the following conditions:
17 * The above copyright notice(s) and this permission notice shall be
18 * included in all copies or substantial portions of the Materials.
20 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
30 * \brief TestCaseGroup utilities
31 *//*--------------------------------------------------------------------*/
33 #include "tcuDefs.hpp"
34 #include "tcuTestCase.hpp"
39 class TestGroupHelper0 : public tcu::TestCaseGroup
42 typedef void (*CreateChildrenFunc) (tcu::TestCaseGroup* testGroup);
44 TestGroupHelper0 (tcu::TestContext& testCtx,
45 const std::string& name,
46 const std::string& description,
47 CreateChildrenFunc createChildren);
48 ~TestGroupHelper0 (void);
53 const CreateChildrenFunc m_createChildren;
56 template<typename Arg0>
57 class TestGroupHelper1 : public tcu::TestCaseGroup
60 typedef void (*CreateChildrenFunc) (tcu::TestCaseGroup* testGroup, Arg0 arg0);
62 TestGroupHelper1 (tcu::TestContext& testCtx,
63 const std::string& name,
64 const std::string& description,
65 CreateChildrenFunc createChildren,
67 : tcu::TestCaseGroup (testCtx, name.c_str(), description.c_str())
68 , m_createChildren (createChildren)
72 void init (void) { m_createChildren(this, m_arg0); }
75 const CreateChildrenFunc m_createChildren;
79 inline tcu::TestCaseGroup* createTestGroup (tcu::TestContext& testCtx,
80 const std::string& name,
81 const std::string& description,
82 TestGroupHelper0::CreateChildrenFunc createChildren)
84 return new TestGroupHelper0(testCtx, name, description, createChildren);
87 template<typename Arg0>
88 tcu::TestCaseGroup* createTestGroup (tcu::TestContext& testCtx,
89 const std::string& name,
90 const std::string& description,
91 typename TestGroupHelper1<Arg0>::CreateChildrenFunc createChildren,
94 return new TestGroupHelper1<Arg0>(testCtx, name, description, createChildren, arg0);
97 inline void addTestGroup (tcu::TestCaseGroup* parent,
98 const std::string& name,
99 const std::string& description,
100 TestGroupHelper0::CreateChildrenFunc createChildren)
102 parent->addChild(createTestGroup(parent->getTestContext(), name, description, createChildren));
105 template<typename Arg0>
106 void addTestGroup (tcu::TestCaseGroup* parent,
107 const std::string& name,
108 const std::string& description,
109 typename TestGroupHelper1<Arg0>::CreateChildrenFunc createChildren,
112 parent->addChild(createTestGroup<Arg0>(parent->getTestContext(), name, description, createChildren, arg0));
117 #endif // _VKTTESTGROUPUTIL_HPP