aboutsummaryrefslogtreecommitdiff
path: root/tests/openssl/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/openssl/driver.cxx')
-rw-r--r--tests/openssl/driver.cxx58
1 files changed, 28 insertions, 30 deletions
diff --git a/tests/openssl/driver.cxx b/tests/openssl/driver.cxx
index d245a3a..55f91dd 100644
--- a/tests/openssl/driver.cxx
+++ b/tests/openssl/driver.cxx
@@ -1,36 +1,18 @@
// file : tests/openssl/driver.cxx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
-#include <cassert>
-
-#ifndef __cpp_lib_modules_ts
#include <vector>
#include <iostream>
#include <iterator>
#include <system_error>
-#endif
-
-// Other includes.
-
-#ifdef __cpp_modules_ts
-#ifdef __cpp_lib_modules_ts
-import std.core;
-import std.io;
-#endif
-import butl.path;
-import butl.utility; // operator<<(ostream, exception)
-import butl.openssl;
-import butl.process;
-import butl.fdstream; // nullfd
-
-import butl.optional; // @@ MOD Clang should not be necessary.
-import butl.small_vector; // @@ MOD Clang should not be necessary.
-#else
-#include <libbutl/path.mxx>
-#include <libbutl/utility.mxx>
-#include <libbutl/openssl.mxx>
-#include <libbutl/fdstream.mxx>
-#endif
+
+#include <libbutl/path.hxx>
+#include <libbutl/utility.hxx> // operator<<(ostream, exception)
+#include <libbutl/openssl.hxx>
+#include <libbutl/fdstream.hxx> // nullfd
+
+#undef NDEBUG
+#include <cassert>
using namespace std;
using namespace butl;
@@ -41,12 +23,28 @@ int
main (int, const char* argv[])
try
{
- openssl os (nullfd, path ("-"), 2, path ("openssl"), "rand", 128);
+ using butl::optional;
+
+ // Test openssl rand command.
+ //
+ {
+ openssl os (nullfd, path ("-"), 2, path ("openssl"), "rand", 128);
+
+ vector<char> r (os.in.read_binary ());
+ os.in.close ();
+
+ assert (os.wait () && r.size () == 128);
+ }
+
+ // Test openssl info retrieval.
+ //
+ {
+ optional<openssl_info> v (openssl::info (2, path ("openssl")));
- vector<char> r (os.in.read_binary ());
- os.in.close ();
+ assert (v);
+ }
- return os.wait () && r.size () == 128 ? 0 : 1;
+ return 0;
}
catch (const system_error& e)
{