istest.pm: Add separate rx() test, second half of txrx()

This commit is contained in:
Heikki Hannikainen 2017-04-16 21:31:45 +03:00
parent 17944aae70
commit 3a5b229959
1 changed files with 23 additions and 16 deletions

View File

@ -14,23 +14,9 @@ use Data::Dumper;
my $debug = 0;
sub txrx($$$$$)
sub rx($$$$)
{
my($ok, $i_tx, $i_rx, $tx, $rx) = @_;
warn "sending: $tx\n" if ($debug);
my $sent = $i_tx->send_packet($tx);
warn "sent\n" if ($debug);
if (!$sent) {
&$ok(0, 1, "Failed to send line to server: '$tx'");
return;
}
if ($i_tx->{'state'} ne 'connected') {
&$ok(1, 0, "Server TX connection error after sending: '$tx': " . $i_tx->{'error'});
}
my($ok, $i_rx, $tx, $rx) = @_;
warn "receiving\n" if ($debug);
@ -55,6 +41,27 @@ sub txrx($$$$$)
&$ok(1, 1, "ok");
}
sub txrx($$$$$)
{
my($ok, $i_tx, $i_rx, $tx, $rx) = @_;
warn "sending: $tx\n" if ($debug);
my $sent = $i_tx->send_packet($tx);
warn "sent\n" if ($debug);
if (!$sent) {
&$ok(0, 1, "Failed to send line to server: '$tx'");
return;
}
if ($i_tx->{'state'} ne 'connected') {
&$ok(1, 0, "Server TX connection error after sending: '$tx': " . $i_tx->{'error'});
}
rx($ok, $i_rx, $tx, $rx);
}
sub should_drop($$$$$;$$)
{
my($ok, $i_tx, $i_rx, $tx, $helper, $no_random_drop, $no_random_helper) = @_;