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"
44 #include "deBlockBuffer.hpp"
45 #include "deFilePath.hpp"
46 #include "dePoolArray.hpp"
47 #include "deRingBuffer.hpp"
48 #include "deSharedPtr.hpp"
49 #include "deThreadSafeRingBuffer.hpp"
50 #include "deUniquePtr.hpp"
51 #include "deRandom.hpp"
52 #include "deCommandLine.hpp"
53 #include "deArrayBuffer.hpp"
54 #include "deStringUtil.hpp"
61 class DepoolTests : public tcu::TestCaseGroup
64 DepoolTests (tcu::TestContext& testCtx)
65 : tcu::TestCaseGroup(testCtx, "depool", "depool self-tests")
71 addChild(new SelfCheckCase(m_testCtx, "array", "dePoolArray_selfTest()", dePoolArray_selfTest));
72 addChild(new SelfCheckCase(m_testCtx, "heap", "dePoolHeap_selfTest()", dePoolHeap_selfTest));
73 addChild(new SelfCheckCase(m_testCtx, "hash", "dePoolHash_selfTest()", dePoolHash_selfTest));
74 addChild(new SelfCheckCase(m_testCtx, "set", "dePoolSet_selfTest()", dePoolSet_selfTest));
75 addChild(new SelfCheckCase(m_testCtx, "hash_set", "dePoolHashSet_selfTest()", dePoolHashSet_selfTest));
76 addChild(new SelfCheckCase(m_testCtx, "hash_array", "dePoolHashArray_selfTest()", dePoolHashArray_selfTest));
77 addChild(new SelfCheckCase(m_testCtx, "multi_set", "dePoolMultiSet_selfTest()", dePoolMultiSet_selfTest));
83 typedef deUint32 (*GetUint32Func) (void);
86 class GetUint32Case : public tcu::TestCase
89 GetUint32Case (tcu::TestContext& testCtx, const char* name, const char* description, GetUint32Func func)
90 : tcu::TestCase (testCtx, name, description)
95 IterateResult iterate (void)
97 m_testCtx.getLog() << TestLog::Message << getDescription() << " returned " << m_func() << TestLog::EndMessage;
98 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
103 GetUint32Func m_func;
106 class DethreadTests : public tcu::TestCaseGroup
109 DethreadTests (tcu::TestContext& testCtx)
110 : tcu::TestCaseGroup(testCtx, "dethread", "dethread self-tests")
116 addChild(new SelfCheckCase(m_testCtx, "thread", "deThread_selfTest()", deThread_selfTest));
117 addChild(new SelfCheckCase(m_testCtx, "mutex", "deMutex_selfTest()", deMutex_selfTest));
118 addChild(new SelfCheckCase(m_testCtx, "semaphore", "deSemaphore_selfTest()", deSemaphore_selfTest));
119 addChild(new SelfCheckCase(m_testCtx, "atomic", "deAtomic_selfTest()", deAtomic_selfTest));
120 addChild(new SelfCheckCase(m_testCtx, "singleton", "deSingleton_selfTest()", deSingleton_selfTest));
121 addChild(new GetUint32Case(m_testCtx, "total_physical_cores", "deGetNumTotalPhysicalCores()", deGetNumTotalPhysicalCores));
122 addChild(new GetUint32Case(m_testCtx, "total_logical_cores", "deGetNumTotalLogicalCores()", deGetNumTotalLogicalCores));
123 addChild(new GetUint32Case(m_testCtx, "available_logical_cores", "deGetNumAvailableLogicalCores()", deGetNumAvailableLogicalCores));
127 class DeutilTests : public tcu::TestCaseGroup
130 DeutilTests (tcu::TestContext& testCtx)
131 : tcu::TestCaseGroup(testCtx, "deutil", "deutil self-tests")
137 addChild(new SelfCheckCase(m_testCtx, "timer", "deTimer_selfTest()", deTimer_selfTest));
141 class DecppTests : public tcu::TestCaseGroup
144 DecppTests (tcu::TestContext& testCtx)
145 : tcu::TestCaseGroup(testCtx, "decpp", "decpp self-tests")
151 addChild(new SelfCheckCase(m_testCtx, "block_buffer", "de::BlockBuffer_selfTest()", de::BlockBuffer_selfTest));
152 addChild(new SelfCheckCase(m_testCtx, "file_path", "de::FilePath_selfTest()", de::FilePath_selfTest));
153 addChild(new SelfCheckCase(m_testCtx, "pool_array", "de::PoolArray_selfTest()", de::PoolArray_selfTest));
154 addChild(new SelfCheckCase(m_testCtx, "ring_buffer", "de::RingBuffer_selfTest()", de::RingBuffer_selfTest));
155 addChild(new SelfCheckCase(m_testCtx, "shared_ptr", "de::SharedPtr_selfTest()", de::SharedPtr_selfTest));
156 addChild(new SelfCheckCase(m_testCtx, "thread_safe_ring_buffer", "de::ThreadSafeRingBuffer_selfTest()", de::ThreadSafeRingBuffer_selfTest));
157 addChild(new SelfCheckCase(m_testCtx, "unique_ptr", "de::UniquePtr_selfTest()", de::UniquePtr_selfTest));
158 addChild(new SelfCheckCase(m_testCtx, "random", "de::Random_selfTest()", de::Random_selfTest));
159 addChild(new SelfCheckCase(m_testCtx, "commandline", "de::cmdline::selfTest()", de::cmdline::selfTest));
160 addChild(new SelfCheckCase(m_testCtx, "array_buffer", "de::ArrayBuffer_selfTest()", de::ArrayBuffer_selfTest));
161 addChild(new SelfCheckCase(m_testCtx, "string_util", "de::StringUtil_selfTest()", de::StringUtil_selfTest));
165 DelibsTests::DelibsTests (tcu::TestContext& testCtx)
166 : tcu::TestCaseGroup(testCtx, "delibs", "delibs Tests")
170 DelibsTests::~DelibsTests (void)
174 void DelibsTests::init (void)
176 addChild(new DepoolTests (m_testCtx));
177 addChild(new DethreadTests (m_testCtx));
178 addChild(new DeutilTests (m_testCtx));
179 addChild(new DecppTests (m_testCtx));