michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=8 sts=2 et sw=2 tw=80: */ michael@0: /* This code is made available to you under your choice of the following sets michael@0: * of licensing terms: michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: */ michael@0: /* Copyright 2014 Mozilla Contributors michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: #include "pkixgtest.h" michael@0: michael@0: namespace mozilla { namespace pkix { namespace test { michael@0: michael@0: std::ostream& michael@0: operator<<(std::ostream& os, const ResultWithPRErrorCode& value) michael@0: { michael@0: switch (value.mRv) michael@0: { michael@0: case Success: michael@0: os << "Success"; michael@0: break; michael@0: case RecoverableError: michael@0: os << "RecoverableError"; michael@0: break; michael@0: case SECFailure: michael@0: os << "FatalError"; michael@0: break; michael@0: default: michael@0: os << "[Invalid Result: " << static_cast(value.mRv) << ']'; michael@0: break; michael@0: } michael@0: michael@0: if (value.mRv != Success) { michael@0: os << '('; michael@0: const char* name = PR_ErrorToName(value.mErrorCode); michael@0: if (name) { michael@0: os << name; michael@0: } else { michael@0: os << value.mErrorCode; michael@0: } michael@0: os << ')'; michael@0: } michael@0: michael@0: return os; michael@0: } michael@0: michael@0: } } } // namespace mozilla::pkix::test