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