8 eval 'use Test::Exception';
9 plan skip_all => 'Test::Exception required' if $@;
13 Net::SSLeay::randomize();
14 Net::SSLeay::load_error_strings();
15 Net::SSLeay::ERR_load_crypto_strings();
16 Net::SSLeay::SSLeay_add_ssl_algorithms();
19 Net::SSLeay::RSA_generate_key(512, 0x10001);
20 }, 'RSA_generate_key with valid callback');
23 Net::SSLeay::RSA_generate_key(512, 0x10001, 1);
24 }, 'RSA_generate_key with invalid callback');
30 Net::SSLeay::RSA_generate_key(512, 0x10001, \&cb);
31 }, 'RSA_generate_key with valid callback');
33 cmp_ok( $called, '>', 0, 'callback has been called' );
39 is( wantarray(), undef, 'RSA_generate_key callback is executed in void context' );
40 is( $d, undef, 'userdata will be undef if no userdata was given' );
42 ok( defined $i, 'first argument is defined' );
43 ok( defined $n, 'second argument is defined' );
55 Net::SSLeay::RSA_generate_key(512, 0x10001, \&cb_data, $userdata);
56 }, 'RSA_generate_key with valid callback and userdata');
58 cmp_ok( $called, '>', 0, 'callback has been called' );
64 is( wantarray(), undef, 'RSA_generate_key callback is executed in void context' );
66 ok( defined $i, 'first argument is defined' );
67 ok( defined $n, 'second argument is defined' );
68 is( $d, $userdata, 'third argument is the userdata we passed in' );