• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)
43 		: TestCase(testCtx, "sample_list", "Basic sample list usage")
44 	{
45 	}
46 
iterate(void)47 	IterateResult iterate (void)
48 	{
49 		TestLog& log = m_testCtx.getLog();
50 
51 		log << TestLog::SampleList("TestSamples", "Test Sample List")
52 			<< TestLog::SampleInfo
53 			<< TestLog::ValueInfo("NumDrawCalls",	"Number of draw calls",		"",		QP_SAMPLE_VALUE_TAG_PREDICTOR)
54 			<< TestLog::ValueInfo("NumOps",			"Number of ops in shader",	"op",	QP_SAMPLE_VALUE_TAG_PREDICTOR)
55 			<< TestLog::ValueInfo("RenderTime",		"Rendering time",			"ms",	QP_SAMPLE_VALUE_TAG_RESPONSE)
56 			<< TestLog::EndSampleInfo;
57 
58 		log << TestLog::Sample << 1 << 2 << 2.3 << TestLog::EndSample
59 			<< TestLog::Sample << 0 << 0 << 0 << TestLog::EndSample
60 			<< TestLog::Sample << 421 << -23 << 0.00001 << TestLog::EndSample
61 			<< TestLog::Sample << 2 << 9 << -1e9 << TestLog::EndSample
62 			<< TestLog::Sample << std::numeric_limits<deInt64>::max() << std::numeric_limits<deInt64>::min() << -0.0f << TestLog::EndSample
63 			<< TestLog::Sample << 0x3355 << 0xf24 << std::numeric_limits<double>::max() << TestLog::EndSample;
64 
65 		log << TestLog::EndSampleList;
66 
67 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
68 		return STOP;
69 	}
70 };
71 
TestLogTests(tcu::TestContext & testCtx)72 TestLogTests::TestLogTests (tcu::TestContext& testCtx)
73 	: TestCaseGroup(testCtx, "testlog", "Test Log Tests")
74 {
75 }
76 
~TestLogTests(void)77 TestLogTests::~TestLogTests (void)
78 {
79 }
80 
init(void)81 void TestLogTests::init (void)
82 {
83 	addChild(new BasicSampleListCase(m_testCtx));
84 }
85 
86 } // dit
87