Remove confidentiality clause from Vulkan CTS license
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / vktTestGroupUtil.hpp
1 #ifndef _VKTTESTGROUPUTIL_HPP
2 #define _VKTTESTGROUPUTIL_HPP
3 /*-------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2016 Google Inc.
8  *
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:
16  *
17  * The above copyright notice(s) and this permission notice shall be
18  * included in all copies or substantial portions of the Materials.
19  *
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.
27  *
28  *//*!
29  * \file
30  * \brief TestCaseGroup utilities
31  *//*--------------------------------------------------------------------*/
32
33 #include "tcuDefs.hpp"
34 #include "tcuTestCase.hpp"
35
36 namespace vkt
37 {
38
39 class TestGroupHelper0 : public tcu::TestCaseGroup
40 {
41 public:
42         typedef void (*CreateChildrenFunc) (tcu::TestCaseGroup* testGroup);
43
44                                                                 TestGroupHelper0        (tcu::TestContext&              testCtx,
45                                                                                                          const std::string&             name,
46                                                                                                          const std::string&             description,
47                                                                                                          CreateChildrenFunc             createChildren);
48                                                                 ~TestGroupHelper0       (void);
49
50         void                                            init                            (void);
51
52 private:
53         const CreateChildrenFunc        m_createChildren;
54 };
55
56 template<typename Arg0>
57 class TestGroupHelper1 : public tcu::TestCaseGroup
58 {
59 public:
60         typedef void (*CreateChildrenFunc) (tcu::TestCaseGroup* testGroup, Arg0 arg0);
61
62                                                                 TestGroupHelper1        (tcu::TestContext&              testCtx,
63                                                                                                          const std::string&             name,
64                                                                                                          const std::string&             description,
65                                                                                                          CreateChildrenFunc             createChildren,
66                                                                                                          const Arg0&                    arg0)
67                                                                         : tcu::TestCaseGroup    (testCtx, name.c_str(), description.c_str())
68                                                                         , m_createChildren              (createChildren)
69                                                                         , m_arg0                                (arg0)
70                                                                 {}
71
72         void                                            init                            (void) { m_createChildren(this, m_arg0); }
73
74 private:
75         const CreateChildrenFunc        m_createChildren;
76         const Arg0                                      m_arg0;
77 };
78
79 inline tcu::TestCaseGroup* createTestGroup (tcu::TestContext&                                           testCtx,
80                                                                                         const std::string&                                              name,
81                                                                                         const std::string&                                              description,
82                                                                                         TestGroupHelper0::CreateChildrenFunc    createChildren)
83 {
84         return new TestGroupHelper0(testCtx, name, description, createChildren);
85 }
86
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,
92                                                                          Arg0                                                                                                   arg0)
93 {
94         return new TestGroupHelper1<Arg0>(testCtx, name, description, createChildren, arg0);
95 }
96
97 } // vkt
98
99 #endif // _VKTTESTGROUPUTIL_HPP