diff --git config/gen/crypto/digest_t.in config/gen/crypto/digest_t.in index 5a3ae17..5357e29 100644 --- config/gen/crypto/digest_t.in +++ config/gen/crypto/digest_t.in @@ -1,14 +1,7 @@ -#! perl -# Copyright (C) 2009, Parrot Foundation. +#! parrot +# Copyright (C) 2001-2009, Parrot Foundation. # $Id$ -use strict; -use warnings; -use lib qw( . lib ../lib ../../lib ); -use Test::More; -use Parrot::Test; -use Parrot::Config; - =head1 NAME t/dynpmc/@TEMP_md_file@.t - test the @TEMP_md_name@ PMC (part of digest_group) @@ -23,30 +16,39 @@ Tests the C a libcrypto wrapper. =cut -if ( !$PConfig{has_crypto} ) { - plan skip_all => "No crypto library available"; -} -elsif ( $PConfig{openssl_version} lt '@TEMP_md_skip@' ) { - plan skip_all => "Too old library"; -} -else { - plan tests => 2; -} +.sub main :main + .include 'test_more.pir' + .include 'iglobals.pasm' + .local pmc config_hash, interp + + plan(2) + interp = getinterp + config_hash = interp[.IGLOBALS_CONFIG_HASH] + $S0 = config_hash['has_crypto'] + $S1 = config_hash['openssl_version'] + unless $S0 goto no_crypto + if $S1 < '0.9' goto old_openssl + + test_typeof() + test_digest() + .return() + no_crypto: + skip(2, 'No crypto library available') + .return() + old_openssl: + skip(2, 'Too old openssl library, needs at least 0.9') +.end + -pir_output_is( << 'CODE', << 'OUTPUT', '@TEMP_md_name@ typeof' ); -.sub test :main +.sub test_typeof $P0 = loadlib 'digest_group' .local pmc md md = new '@TEMP_md_name@' $S0 = typeof md - say $S0 + is($S0, '@TEMP_md_name@', '@TEMP_md_name@ typeof') .end -CODE -@TEMP_md_name@ -OUTPUT -pir_output_like( << 'CODE', << 'OUTPUT', '@TEMP_md_name@ digest' ); -.sub test :main +.sub test_digest $P0 = loadlib 'digest_group' .local pmc md md = new '@TEMP_md_name@' @@ -57,24 +59,22 @@ pir_output_like( << 'CODE', << 'OUTPUT', '@TEMP_md_name@ digest' ); $P0 = split '', $S0 new $P1, 'FixedPMCArray' set $P1, 1 + $S3 = '' L1: unless $P0 goto L2 $S1 = shift $P0 $I1 = ord $S1 $P1[0] = $I1 $S2 = sprintf '%02x', $P1 - print $S2 + $S3 .= $S2 goto L1 L2: - print "\n" + like($S3, '@TEMP_md_result@', '@TEMP_md_name@ digest') .end -CODE -/^@TEMP_md_result@$/ -OUTPUT # Local Variables: # mode: cperl # cperl-indent-level: 4 # fill-column: 100 # End: -# vim: expandtab shiftwidth=4: +# vim: expandtab shiftwidth=4 filetype=pir: