1 #include <boost/test/unit_test.hpp>
4 #include "io/opensslBIO.h"
6 class OpensslBIO1 : public OpensslBIO {
10 int write( const char* buf, int num );
11 int read( char* buf, int size );
12 long ctrl( int cmod, long arg1, void* arg2 );
14 static const char* getName();
17 int OpensslBIO1::write( const char* buf, int num ) {
23 int OpensslBIO1::read( char* buf, int size ) {
29 long OpensslBIO1::ctrl( int cmod, long arg1, void* arg2 ) {
36 const char* OpensslBIO1::getName() {
40 BOOST_AUTO_TEST_SUITE( TestBioWrapper )
42 BOOST_AUTO_TEST_CASE( BasicCalls ) {
43 std::shared_ptr<BIO> n( BIO_new( toBio<OpensslBIO1>() ), BIO_free );
44 OpensslBIO* o = new OpensslBIOWrapper( n );
45 OpensslBIO1* data = ( OpensslBIO1* ) n->ptr;
47 o->write( "bla", 13 );
48 BOOST_CHECK( data->state == 13 * 2 );
52 BOOST_CHECK( data->state == 17 * 3 );
55 BOOST_CHECK( data->state == 19 * 7 );
60 BOOST_AUTO_TEST_SUITE_END()