1/*-------------------------------------------------------------------------
2 * drawElements Quality Program Test Executor
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 case result models.
22 *//*--------------------------------------------------------------------*/
23
24#include "xeTestCaseResult.hpp"
25
26#include <iomanip>
27#include <limits>
28
29namespace xe
30{
31
32const char* getTestStatusCodeName (TestStatusCode code)
33{
34	switch (code)
35	{
36		case TESTSTATUSCODE_PASS:					return "Pass";
37		case TESTSTATUSCODE_FAIL:					return "Fail";
38		case TESTSTATUSCODE_QUALITY_WARNING:		return "QualityWarning";
39		case TESTSTATUSCODE_COMPATIBILITY_WARNING:	return "CompatibilityWarning";
40		case TESTSTATUSCODE_PENDING:				return "Pending";
41		case TESTSTATUSCODE_RUNNING:				return "Running";
42		case TESTSTATUSCODE_NOT_SUPPORTED:			return "NotSupported";
43		case TESTSTATUSCODE_RESOURCE_ERROR:			return "ResourceError";
44		case TESTSTATUSCODE_INTERNAL_ERROR:			return "InternalError";
45		case TESTSTATUSCODE_CANCELED:				return "Canceled";
46		case TESTSTATUSCODE_TIMEOUT:				return "Timeout";
47		case TESTSTATUSCODE_CRASH:					return "Crash";
48		case TESTSTATUSCODE_DISABLED:				return "Disabled";
49		case TESTSTATUSCODE_TERMINATED:				return "Terminated";
50		default:
51			DE_ASSERT(false);
52			return DE_NULL;
53	}
54}
55
56namespace ri
57{
58
59List::List (void)
60{
61}
62
63List::~List (void)
64{
65	for (std::vector<Item*>::iterator i = m_items.begin(); i != m_items.end(); i++)
66		delete *i;
67	m_items.clear();
68}
69
70std::ostream& operator<< (std::ostream& str, const NumericValue& value)
71{
72	switch (value.getType())
73	{
74		case NumericValue::TYPE_FLOAT64:
75			return str << std::setprecision(std::numeric_limits<double>::digits10 + 2) << value.getFloat64();
76
77		case NumericValue::TYPE_INT64:
78			return str << value.getInt64();
79
80		default:
81			DE_ASSERT(value.getType() == NumericValue::TYPE_EMPTY);
82			return str;
83	}
84}
85
86} // ri
87} // xe
88