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		case TESTSTATUSCODE_WAIVER:					return "Waived";
51		default:
52			DE_ASSERT(false);
53			return DE_NULL;
54	}
55}
56
57namespace ri
58{
59
60List::List (void)
61{
62}
63
64List::~List (void)
65{
66	for (std::vector<Item*>::iterator i = m_items.begin(); i != m_items.end(); i++)
67		delete *i;
68	m_items.clear();
69}
70
71std::ostream& operator<< (std::ostream& str, const NumericValue& value)
72{
73	switch (value.getType())
74	{
75		case NumericValue::NUMVALTYPE_FLOAT64:
76			return str << std::setprecision(std::numeric_limits<double>::digits10 + 2) << value.getFloat64();
77
78		case NumericValue::NUMVALTYPE_INT64:
79			return str << value.getInt64();
80
81		default:
82			DE_ASSERT(value.getType() == NumericValue::NUMVALTYPE_EMPTY);
83			return str;
84	}
85}
86
87} // ri
88} // xe
89