aboutsummaryrefslogtreecommitdiff
path: root/openssl/types.cxx
blob: ce59036db5e479423b4960a9765338d57fb23645 (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
// file      : openssl/types.cxx -*- C++ -*-
// 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 + "'");
  }
}