Merge "Remove EGL gles1.rgb565_window from mustpass" am: 7bff163e7f am: 8d0d1e55f9
[platform/upstream/VK-GL-CTS.git] / modules / internal / ditDelibsTests.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 delibs self-tests.
22  *//*--------------------------------------------------------------------*/
23
24 #include "ditDelibsTests.hpp"
25 #include "tcuTestLog.hpp"
26
27 // depool
28 #include "dePoolArray.h"
29 #include "dePoolHeap.h"
30 #include "dePoolHash.h"
31 #include "dePoolSet.h"
32 #include "dePoolHashSet.h"
33 #include "dePoolHashArray.h"
34 #include "dePoolMultiSet.h"
35
36 // dethread
37 #include "deThreadTest.h"
38 #include "deThread.h"
39
40 // deutil
41 #include "deTimerTest.h"
42 #include "deCommandLine.h"
43
44 // debase
45 #include "deInt32.h"
46 #include "deFloat16.h"
47 #include "deMath.h"
48 #include "deSha1.h"
49 #include "deMemory.h"
50
51 // decpp
52 #include "deBlockBuffer.hpp"
53 #include "deFilePath.hpp"
54 #include "dePoolArray.hpp"
55 #include "deRingBuffer.hpp"
56 #include "deSharedPtr.hpp"
57 #include "deThreadSafeRingBuffer.hpp"
58 #include "deUniquePtr.hpp"
59 #include "deRandom.hpp"
60 #include "deCommandLine.hpp"
61 #include "deArrayBuffer.hpp"
62 #include "deStringUtil.hpp"
63 #include "deSpinBarrier.hpp"
64 #include "deSTLUtil.hpp"
65 #include "deAppendList.hpp"
66
67 namespace dit
68 {
69
70 using tcu::TestLog;
71
72 class DepoolTests : public tcu::TestCaseGroup
73 {
74 public:
75         DepoolTests (tcu::TestContext& testCtx)
76                 : tcu::TestCaseGroup(testCtx, "depool", "depool self-tests")
77         {
78         }
79
80         void init (void)
81         {
82                 addChild(new SelfCheckCase(m_testCtx, "array",          "dePoolArray_selfTest()",               dePoolArray_selfTest));
83                 addChild(new SelfCheckCase(m_testCtx, "heap",           "dePoolHeap_selfTest()",                dePoolHeap_selfTest));
84                 addChild(new SelfCheckCase(m_testCtx, "hash",           "dePoolHash_selfTest()",                dePoolHash_selfTest));
85                 addChild(new SelfCheckCase(m_testCtx, "set",            "dePoolSet_selfTest()",                 dePoolSet_selfTest));
86                 addChild(new SelfCheckCase(m_testCtx, "hash_set",       "dePoolHashSet_selfTest()",             dePoolHashSet_selfTest));
87                 addChild(new SelfCheckCase(m_testCtx, "hash_array",     "dePoolHashArray_selfTest()",   dePoolHashArray_selfTest));
88                 addChild(new SelfCheckCase(m_testCtx, "multi_set",      "dePoolMultiSet_selfTest()",    dePoolMultiSet_selfTest));
89         }
90 };
91
92 extern "C"
93 {
94 typedef deUint32        (*GetUint32Func)        (void);
95 }
96
97 class GetUint32Case : public tcu::TestCase
98 {
99 public:
100         GetUint32Case (tcu::TestContext& testCtx, const char* name, const char* description, GetUint32Func func)
101                 : tcu::TestCase (testCtx, name, description)
102                 , m_func                (func)
103         {
104         }
105
106         IterateResult iterate (void)
107         {
108                 m_testCtx.getLog() << TestLog::Message << getDescription() << " returned " << m_func() << TestLog::EndMessage;
109                 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
110                 return STOP;
111         }
112
113 private:
114         GetUint32Func   m_func;
115 };
116
117 class DethreadTests : public tcu::TestCaseGroup
118 {
119 public:
120         DethreadTests (tcu::TestContext& testCtx)
121                 : tcu::TestCaseGroup(testCtx, "dethread", "dethread self-tests")
122         {
123         }
124
125         void init (void)
126         {
127                 addChild(new SelfCheckCase(m_testCtx, "thread",                                         "deThread_selfTest()",                          deThread_selfTest));
128                 addChild(new SelfCheckCase(m_testCtx, "mutex",                                          "deMutex_selfTest()",                           deMutex_selfTest));
129                 addChild(new SelfCheckCase(m_testCtx, "semaphore",                                      "deSemaphore_selfTest()",                       deSemaphore_selfTest));
130                 addChild(new SelfCheckCase(m_testCtx, "atomic",                                         "deAtomic_selfTest()",                          deAtomic_selfTest));
131                 addChild(new SelfCheckCase(m_testCtx, "singleton",                                      "deSingleton_selfTest()",                       deSingleton_selfTest));
132                 addChild(new GetUint32Case(m_testCtx, "total_physical_cores",           "deGetNumTotalPhysicalCores()",         deGetNumTotalPhysicalCores));
133                 addChild(new GetUint32Case(m_testCtx, "total_logical_cores",            "deGetNumTotalLogicalCores()",          deGetNumTotalLogicalCores));
134                 addChild(new GetUint32Case(m_testCtx, "available_logical_cores",        "deGetNumAvailableLogicalCores()",      deGetNumAvailableLogicalCores));
135         }
136 };
137
138 class DeutilTests : public tcu::TestCaseGroup
139 {
140 public:
141         DeutilTests (tcu::TestContext& testCtx)
142                 : tcu::TestCaseGroup(testCtx, "deutil", "deutil self-tests")
143         {
144         }
145
146         void init (void)
147         {
148                 addChild(new SelfCheckCase(m_testCtx, "timer",                  "deTimer_selfTest()",           deTimer_selfTest));
149                 addChild(new SelfCheckCase(m_testCtx, "command_line",   "deCommandLine_selfTest()",     deCommandLine_selfTest));
150         }
151 };
152
153 class DebaseTests : public tcu::TestCaseGroup
154 {
155 public:
156         DebaseTests (tcu::TestContext& testCtx)
157                 : tcu::TestCaseGroup(testCtx, "debase", "debase self-tests")
158         {
159         }
160
161         void init (void)
162         {
163                 addChild(new SelfCheckCase(m_testCtx, "int32",          "deInt32_selfTest()",   deInt32_selfTest));
164                 addChild(new SelfCheckCase(m_testCtx, "float16",        "deFloat16_selfTest()", deFloat16_selfTest));
165                 addChild(new SelfCheckCase(m_testCtx, "math",           "deMath_selfTest()",    deMath_selfTest));
166                 addChild(new SelfCheckCase(m_testCtx, "sha1",           "deSha1_selfTest()",    deSha1_selfTest));
167                 addChild(new SelfCheckCase(m_testCtx, "memory",         "deMemory_selfTest()",  deMemory_selfTest));
168         }
169 };
170
171 class DecppTests : public tcu::TestCaseGroup
172 {
173 public:
174         DecppTests (tcu::TestContext& testCtx)
175                 : tcu::TestCaseGroup(testCtx, "decpp", "decpp self-tests")
176         {
177         }
178
179         void init (void)
180         {
181                 addChild(new SelfCheckCase(m_testCtx, "block_buffer",                           "de::BlockBuffer_selfTest()",                   de::BlockBuffer_selfTest));
182                 addChild(new SelfCheckCase(m_testCtx, "file_path",                                      "de::FilePath_selfTest()",                              de::FilePath_selfTest));
183                 addChild(new SelfCheckCase(m_testCtx, "pool_array",                                     "de::PoolArray_selfTest()",                             de::PoolArray_selfTest));
184                 addChild(new SelfCheckCase(m_testCtx, "ring_buffer",                            "de::RingBuffer_selfTest()",                    de::RingBuffer_selfTest));
185                 addChild(new SelfCheckCase(m_testCtx, "shared_ptr",                                     "de::SharedPtr_selfTest()",                             de::SharedPtr_selfTest));
186                 addChild(new SelfCheckCase(m_testCtx, "thread_safe_ring_buffer",        "de::ThreadSafeRingBuffer_selfTest()",  de::ThreadSafeRingBuffer_selfTest));
187                 addChild(new SelfCheckCase(m_testCtx, "unique_ptr",                                     "de::UniquePtr_selfTest()",                             de::UniquePtr_selfTest));
188                 addChild(new SelfCheckCase(m_testCtx, "random",                                         "de::Random_selfTest()",                                de::Random_selfTest));
189                 addChild(new SelfCheckCase(m_testCtx, "commandline",                            "de::cmdline::selfTest()",                              de::cmdline::selfTest));
190                 addChild(new SelfCheckCase(m_testCtx, "array_buffer",                           "de::ArrayBuffer_selfTest()",                   de::ArrayBuffer_selfTest));
191                 addChild(new SelfCheckCase(m_testCtx, "string_util",                            "de::StringUtil_selfTest()",                    de::StringUtil_selfTest));
192                 addChild(new SelfCheckCase(m_testCtx, "spin_barrier",                           "de::SpinBarrier_selfTest()",                   de::SpinBarrier_selfTest));
193                 addChild(new SelfCheckCase(m_testCtx, "stl_util",                                       "de::STLUtil_selfTest()",                               de::STLUtil_selfTest));
194                 addChild(new SelfCheckCase(m_testCtx, "append_list",                            "de::AppendList_selfTest()",                    de::AppendList_selfTest));
195         }
196 };
197
198 DelibsTests::DelibsTests (tcu::TestContext& testCtx)
199         : tcu::TestCaseGroup(testCtx, "delibs", "delibs Tests")
200 {
201 }
202
203 DelibsTests::~DelibsTests (void)
204 {
205 }
206
207 void DelibsTests::init (void)
208 {
209         addChild(new DepoolTests        (m_testCtx));
210         addChild(new DethreadTests      (m_testCtx));
211         addChild(new DeutilTests        (m_testCtx));
212         addChild(new DebaseTests        (m_testCtx));
213         addChild(new DecppTests         (m_testCtx));
214 }
215
216 } // dit