3 #include <boost/test/unit_test.hpp>
6 #include "opensslBIO.h"
8 class OpensslBIO1 : public OpensslBIO {
12 int write( const char* buf, int num );
13 int read( char* buf, int size );
14 long ctrl( int cmod, long arg1, void* arg2 );
16 static const char* getName();
19 int OpensslBIO1::write( const char* buf, int num ) {
24 int OpensslBIO1::read( char* buf, int size ) {
29 long OpensslBIO1::ctrl( int cmod, long arg1, void* arg2 ) {
35 const char* OpensslBIO1::getName() {
39 BOOST_AUTO_TEST_SUITE( TestBioWrapper )
41 BOOST_AUTO_TEST_CASE( BasicCalls ) {
42 BIO* n = BIO_new( toBio<OpensslBIO1>() );
43 OpensslBIO* o = new OpensslBIOWrapper( n );
44 OpensslBIO1* data = ( OpensslBIO1* ) n->ptr;
46 o->write( "bla", 13 );
47 BOOST_CHECK( data->state == 13 * 2 );
51 BOOST_CHECK( data->state == 17 * 3 );
54 BOOST_CHECK( data->state == 19 * 7 );
59 BOOST_AUTO_TEST_SUITE_END()