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 Test log output tests.
22 *//*--------------------------------------------------------------------*/
23
24 #include "ditTestLogTests.hpp"
25 #include "tcuTestLog.hpp"
26
27 #include <limits>
28
29 namespace dit
30 {
31
32 using tcu::TestLog;
33
34 // \todo [2014-02-25 pyry] Extend with:
35 // - output of all element types
36 // - nested element cases (sections, image sets)
37 // - parse results and verify
38
39 class BasicSampleListCase : public tcu::TestCase
40 {
41 public:
BasicSampleListCase(tcu::TestContext & testCtx)42 BasicSampleListCase(tcu::TestContext &testCtx) : TestCase(testCtx, "sample_list", "Basic sample list usage")
43 {
44 }
45
iterate(void)46 IterateResult iterate(void)
47 {
48 TestLog &log = m_testCtx.getLog();
49
50 log << TestLog::SampleList("TestSamples", "Test Sample List") << TestLog::SampleInfo
51 << TestLog::ValueInfo("NumDrawCalls", "Number of draw calls", "", QP_SAMPLE_VALUE_TAG_PREDICTOR)
52 << TestLog::ValueInfo("NumOps", "Number of ops in shader", "op", QP_SAMPLE_VALUE_TAG_PREDICTOR)
53 << TestLog::ValueInfo("RenderTime", "Rendering time", "ms", QP_SAMPLE_VALUE_TAG_RESPONSE)
54 << TestLog::EndSampleInfo;
55
56 log << TestLog::Sample << 1 << 2 << 2.3 << TestLog::EndSample << TestLog::Sample << 0 << 0 << 0
57 << TestLog::EndSample << TestLog::Sample << 421 << -23 << 0.00001 << TestLog::EndSample << TestLog::Sample
58 << 2 << 9 << -1e9 << TestLog::EndSample << TestLog::Sample << std::numeric_limits<int64_t>::max()
59 << std::numeric_limits<int64_t>::min() << -0.0f << TestLog::EndSample << TestLog::Sample << 0x3355 << 0xf24
60 << std::numeric_limits<double>::max() << TestLog::EndSample;
61
62 log << TestLog::EndSampleList;
63
64 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
65 return STOP;
66 }
67 };
68
TestLogTests(tcu::TestContext & testCtx)69 TestLogTests::TestLogTests(tcu::TestContext &testCtx) : TestCaseGroup(testCtx, "testlog", "Test Log Tests")
70 {
71 }
72
~TestLogTests(void)73 TestLogTests::~TestLogTests(void)
74 {
75 }
76
init(void)77 void TestLogTests::init(void)
78 {
79 addChild(new BasicSampleListCase(m_testCtx));
80 }
81
82 } // namespace dit
83