filter tests: my position and friend position

git-svn-id: http://repo.ham.fi/svn/aprsc/trunk@444 3ce903b1-3385-4e86-93cd-f9a4a239f7ac
This commit is contained in:
Heikki Hannikainen 2012-06-10 14:09:45 +00:00
parent b2e5daca0e
commit fa27405bc5
1 changed files with 21 additions and 2 deletions

View File

@ -3,7 +3,7 @@
# #
use Test; use Test;
BEGIN { plan tests => 6 + 4 + 1 }; BEGIN { plan tests => 6 + 4 + 2 + 1 };
use runproduct; use runproduct;
use istest; use istest;
use Ham::APRS::IS; use Ham::APRS::IS;
@ -15,12 +15,13 @@ ok(defined $p, 1, "Failed to initialize product runner");
ok($p->start(), 1, "Failed to start product"); ok($p->start(), 1, "Failed to start product");
my $login = "N5CAL-1"; my $login = "N5CAL-1";
my $rxlogin = "N5CAL-2";
my $server_call = "TESTING"; my $server_call = "TESTING";
my $i_tx = new Ham::APRS::IS("localhost:55580", $login); my $i_tx = new Ham::APRS::IS("localhost:55580", $login);
ok(defined $i_tx, 1, "Failed to initialize Ham::APRS::IS"); ok(defined $i_tx, 1, "Failed to initialize Ham::APRS::IS");
# allow range, then drop using a buddy filter # allow range, then drop using a buddy filter
my $i_rx = new Ham::APRS::IS("localhost:55581", "N5CAL-2"); my $i_rx = new Ham::APRS::IS("localhost:55581", $rxlogin);
ok(defined $i_rx, 1, "Failed to initialize Ham::APRS::IS"); ok(defined $i_rx, 1, "Failed to initialize Ham::APRS::IS");
my $ret; my $ret;
@ -32,6 +33,7 @@ ok($ret, 1, "Failed to connect to the server: " . $i_rx->{'error'});
my($tx, $rx, $helper); my($tx, $rx, $helper);
###############################################
# filter for area in north-east # filter for area in north-east
$i_rx->sendline("#filter a/60.1874/24.8362/60.1872/24.8365"); $i_rx->sendline("#filter a/60.1874/24.8362/60.1872/24.8365");
sleep(0.5); sleep(0.5);
@ -56,6 +58,23 @@ $pass = "PU2TFG-15>BEACON,qAR,PY2PE-1:Rede Brasileira de APRS - Aluminio/SP";
$drop = "DR0P-15>APN390,qAR,PY2PE-1:!2334.10S/04719.70E# drop east"; $drop = "DR0P-15>APN390,qAR,PY2PE-1:!2334.10S/04719.70E# drop east";
istest::should_drop(\&ok, $i_tx, $i_rx, $drop, $pass); istest::should_drop(\&ok, $i_tx, $i_rx, $drop, $pass);
###############################################
# filter for range around my position, and transmit my position too
# also set a filter for friend range (it's position is already known
# from previous test)
$i_rx->sendline("#filter m/1 f/OH2TI/10");
$i_rx->sendline("$rxlogin>APRS:!/0%<RTgK[>yL_");
sleep(0.5);
$pass = "T3ST>APRS,qAR,$login:!/0%<RTgK[>yL_ test"; # the same position...
$drop = "DR0P-15>APN390,qAR,$login:!2334.10S/04719.70E#";
istest::should_drop(\&ok, $i_tx, $i_rx, $drop, $pass);
# OH2TI is close enough to OH2TI, OH2FOI is not.
$pass = "OH1UK>APRS,TCPIP*,qAC,T2FINLAND:;OH2TA *101302z6014.89N/02447.00Ey";
$drop = "OH2FOI>APRS,qAR,$login:!6013.90N/02500.05E-";
istest::should_drop(\&ok, $i_tx, $i_rx, $drop, $pass);
# stop # stop
ok($p->stop(), 1, "Failed to stop product"); ok($p->stop(), 1, "Failed to stop product");