1 /*-------------------------------------------------------------------------
2 * drawElements Internal Test Module
3 * ---------------------------------
5 * Copyright 2014 The Android Open Source Project
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * \brief delibs self-tests.
22 *//*--------------------------------------------------------------------*/
24 #include "ditDelibsTests.hpp"
25 #include "tcuTestLog.hpp"
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"
37 #include "deThreadTest.h"
41 #include "deTimerTest.h"
42 #include "deCommandLine.h"
49 #include "deBlockBuffer.hpp"
50 #include "deFilePath.hpp"
51 #include "dePoolArray.hpp"
52 #include "deRingBuffer.hpp"
53 #include "deSharedPtr.hpp"
54 #include "deThreadSafeRingBuffer.hpp"
55 #include "deUniquePtr.hpp"
56 #include "deRandom.hpp"
57 #include "deCommandLine.hpp"
58 #include "deArrayBuffer.hpp"
59 #include "deStringUtil.hpp"
60 #include "deSpinBarrier.hpp"
61 #include "deSTLUtil.hpp"
68 class DepoolTests : public tcu::TestCaseGroup
71 DepoolTests (tcu::TestContext& testCtx)
72 : tcu::TestCaseGroup(testCtx, "depool", "depool self-tests")
78 addChild(new SelfCheckCase(m_testCtx, "array", "dePoolArray_selfTest()", dePoolArray_selfTest));
79 addChild(new SelfCheckCase(m_testCtx, "heap", "dePoolHeap_selfTest()", dePoolHeap_selfTest));
80 addChild(new SelfCheckCase(m_testCtx, "hash", "dePoolHash_selfTest()", dePoolHash_selfTest));
81 addChild(new SelfCheckCase(m_testCtx, "set", "dePoolSet_selfTest()", dePoolSet_selfTest));
82 addChild(new SelfCheckCase(m_testCtx, "hash_set", "dePoolHashSet_selfTest()", dePoolHashSet_selfTest));
83 addChild(new SelfCheckCase(m_testCtx, "hash_array", "dePoolHashArray_selfTest()", dePoolHashArray_selfTest));
84 addChild(new SelfCheckCase(m_testCtx, "multi_set", "dePoolMultiSet_selfTest()", dePoolMultiSet_selfTest));
90 typedef deUint32 (*GetUint32Func) (void);
93 class GetUint32Case : public tcu::TestCase
96 GetUint32Case (tcu::TestContext& testCtx, const char* name, const char* description, GetUint32Func func)
97 : tcu::TestCase (testCtx, name, description)
102 IterateResult iterate (void)
104 m_testCtx.getLog() << TestLog::Message << getDescription() << " returned " << m_func() << TestLog::EndMessage;
105 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
110 GetUint32Func m_func;
113 class DethreadTests : public tcu::TestCaseGroup
116 DethreadTests (tcu::TestContext& testCtx)
117 : tcu::TestCaseGroup(testCtx, "dethread", "dethread self-tests")
123 addChild(new SelfCheckCase(m_testCtx, "thread", "deThread_selfTest()", deThread_selfTest));
124 addChild(new SelfCheckCase(m_testCtx, "mutex", "deMutex_selfTest()", deMutex_selfTest));
125 addChild(new SelfCheckCase(m_testCtx, "semaphore", "deSemaphore_selfTest()", deSemaphore_selfTest));
126 addChild(new SelfCheckCase(m_testCtx, "atomic", "deAtomic_selfTest()", deAtomic_selfTest));
127 addChild(new SelfCheckCase(m_testCtx, "singleton", "deSingleton_selfTest()", deSingleton_selfTest));
128 addChild(new GetUint32Case(m_testCtx, "total_physical_cores", "deGetNumTotalPhysicalCores()", deGetNumTotalPhysicalCores));
129 addChild(new GetUint32Case(m_testCtx, "total_logical_cores", "deGetNumTotalLogicalCores()", deGetNumTotalLogicalCores));
130 addChild(new GetUint32Case(m_testCtx, "available_logical_cores", "deGetNumAvailableLogicalCores()", deGetNumAvailableLogicalCores));
134 class DeutilTests : public tcu::TestCaseGroup
137 DeutilTests (tcu::TestContext& testCtx)
138 : tcu::TestCaseGroup(testCtx, "deutil", "deutil self-tests")
144 addChild(new SelfCheckCase(m_testCtx, "timer", "deTimer_selfTest()", deTimer_selfTest));
145 addChild(new SelfCheckCase(m_testCtx, "command_line", "deCommandLine_selfTest()", deCommandLine_selfTest));
149 class DebaseTests : public tcu::TestCaseGroup
152 DebaseTests (tcu::TestContext& testCtx)
153 : tcu::TestCaseGroup(testCtx, "debase", "debase self-tests")
159 addChild(new SelfCheckCase(m_testCtx, "int32", "deInt32_selfTest()", deInt32_selfTest));
160 addChild(new SelfCheckCase(m_testCtx, "math", "deMath_selfTest()", deMath_selfTest));
164 class DecppTests : public tcu::TestCaseGroup
167 DecppTests (tcu::TestContext& testCtx)
168 : tcu::TestCaseGroup(testCtx, "decpp", "decpp self-tests")
174 addChild(new SelfCheckCase(m_testCtx, "block_buffer", "de::BlockBuffer_selfTest()", de::BlockBuffer_selfTest));
175 addChild(new SelfCheckCase(m_testCtx, "file_path", "de::FilePath_selfTest()", de::FilePath_selfTest));
176 addChild(new SelfCheckCase(m_testCtx, "pool_array", "de::PoolArray_selfTest()", de::PoolArray_selfTest));
177 addChild(new SelfCheckCase(m_testCtx, "ring_buffer", "de::RingBuffer_selfTest()", de::RingBuffer_selfTest));
178 addChild(new SelfCheckCase(m_testCtx, "shared_ptr", "de::SharedPtr_selfTest()", de::SharedPtr_selfTest));
179 addChild(new SelfCheckCase(m_testCtx, "thread_safe_ring_buffer", "de::ThreadSafeRingBuffer_selfTest()", de::ThreadSafeRingBuffer_selfTest));
180 addChild(new SelfCheckCase(m_testCtx, "unique_ptr", "de::UniquePtr_selfTest()", de::UniquePtr_selfTest));
181 addChild(new SelfCheckCase(m_testCtx, "random", "de::Random_selfTest()", de::Random_selfTest));
182 addChild(new SelfCheckCase(m_testCtx, "commandline", "de::cmdline::selfTest()", de::cmdline::selfTest));
183 addChild(new SelfCheckCase(m_testCtx, "array_buffer", "de::ArrayBuffer_selfTest()", de::ArrayBuffer_selfTest));
184 addChild(new SelfCheckCase(m_testCtx, "string_util", "de::StringUtil_selfTest()", de::StringUtil_selfTest));
185 addChild(new SelfCheckCase(m_testCtx, "spin_barrier", "de::SpinBarrier_selfTest()", de::SpinBarrier_selfTest));
186 addChild(new SelfCheckCase(m_testCtx, "stl_util", "de::STLUtil_selfTest()", de::STLUtil_selfTest));
190 DelibsTests::DelibsTests (tcu::TestContext& testCtx)
191 : tcu::TestCaseGroup(testCtx, "delibs", "delibs Tests")
195 DelibsTests::~DelibsTests (void)
199 void DelibsTests::init (void)
201 addChild(new DepoolTests (m_testCtx));
202 addChild(new DethreadTests (m_testCtx));
203 addChild(new DeutilTests (m_testCtx));
204 addChild(new DebaseTests (m_testCtx));
205 addChild(new DecppTests (m_testCtx));