diff options
author | lloyd <[email protected]> | 2014-01-07 00:30:03 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-07 00:30:03 +0000 |
commit | 52d3fd79aac9decf6cb0ef617e7638abe7ebd053 (patch) | |
tree | cdc9079db267ff5eea72f609cbd82f9985c631bc /src/contrib/perl-xs/t/testutl.pl | |
parent | 76efeb142e5da153bd6d98939754f714a5ecd550 (diff) |
Move python to src, add to main makefile
Diffstat (limited to 'src/contrib/perl-xs/t/testutl.pl')
-rw-r--r-- | src/contrib/perl-xs/t/testutl.pl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/contrib/perl-xs/t/testutl.pl b/src/contrib/perl-xs/t/testutl.pl new file mode 100644 index 000000000..add6f6a45 --- /dev/null +++ b/src/contrib/perl-xs/t/testutl.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +sub random_message_ok +{ + my ($pipe, $iter, $chunkmax) = @_; + $iter = 100 unless defined $iter; + $chunkmax = 300 unless defined $chunkmax; + eval { + my $input = ''; + $pipe->start_msg(); + for(my $i = 0; $i < $iter; $i++) + { + my $chunk = ''; + my $chunklen = int(rand($chunkmax)); + $chunk .= pack("C", int(rand(256))) while $chunklen--; + $input .= $chunk; + $pipe->write($chunk); + } + $pipe->end_msg(); + my $msg_num = $pipe->message_count() -1; + my $output = $pipe->read(0xFFFFFFFF, $msg_num); + return $input eq $output; + }; +} + +1; |