1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2016 The Khronos Group Inc.
6 * Copyright (c) 2016 Imagination Technologies Ltd.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 *//*!
21 * \file
22 * \brief Robust Buffer Access Tests
23 *//*--------------------------------------------------------------------*/
24
25 #include "vktRobustnessTests.hpp"
26 #include "vktRobustnessBufferAccessTests.hpp"
27 #include "vktRobustnessVertexAccessTests.hpp"
28 #include "vktRobustBufferAccessWithVariablePointersTests.hpp"
29 #include "vktTestGroupUtil.hpp"
30
31 namespace vkt
32 {
33 namespace robustness
34 {
35
36 namespace
37 {
38
39 class IsNodeNamed
40 {
41 public:
IsNodeNamed(const std::string & name)42 IsNodeNamed(const std::string& name)
43 : checkName(name)
44 {}
operator ()(tcu::TestNode * node)45 bool operator()(tcu::TestNode* node)
46 {
47 return checkName == std::string(node->getName());
48 }
49 private:
50 const std::string checkName;
51 };
52
53 }
54
createTests(tcu::TestContext & testCtx)55 tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx)
56 {
57 de::MovePtr<tcu::TestCaseGroup> robustnessTests(new tcu::TestCaseGroup(testCtx, "robustness", ""));
58
59 robustnessTests->addChild(createBufferAccessTests(testCtx));
60 robustnessTests->addChild(createVertexAccessTests(testCtx));
61
62 std::vector<tcu::TestNode*> children;
63 robustnessTests->getChildren(children);
64 std::vector<tcu::TestNode*>::iterator buffer_access = std::find_if(children.begin(), children.end(), IsNodeNamed("buffer_access"));
65 if (buffer_access != children.end())
66 {
67 (*buffer_access)->addChild(createBufferAccessWithVariablePointersTests(testCtx));
68 }
69 else
70 {
71 de::MovePtr<tcu::TestCaseGroup> bufferAccess(new tcu::TestCaseGroup(testCtx, "buffer_access", ""));
72 bufferAccess->addChild(createBufferAccessWithVariablePointersTests(testCtx));
73 robustnessTests->addChild(bufferAccess.release());
74 }
75
76 return robustnessTests.release();
77 }
78
79 } // robustness
80 } // vkt
81