aboutsummaryrefslogtreecommitdiff
path: root/openssl/types.cxx
blob: 6acde44f15148d5ad3f033d9bae95f709a58a1c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// file      : openssl/types.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#include <openssl/types.hxx>

namespace openssl
{
  string
  to_string (simulate_outcome s)
  {
    switch (s)
    {
    case simulate_outcome::success: return "success";
    case simulate_outcome::failure: return "failure";
    }

    assert (false);
    return string ();
  }

  simulate_outcome
  to_simulate_outcome (const string& s)
  {
         if (s == "success") return simulate_outcome::success;
    else if (s == "failure") return simulate_outcome::failure;
    else throw invalid_argument ("invalid simulate outcome '" + s + "'");
  }
}