[BACK]Return to 31-decode-linktest.t CVS log [TXT][DIR] Up to [local] / trango / Net-Telnet-Trango / t

Annotation of trango/Net-Telnet-Trango/t/31-decode-linktest.t, Revision 1.2

1.1       andrew      1: #!perl -T
1.2     ! andrew      2: # $RedRiver: 25-decode_linktest.t,v 1.1 2008/02/08 16:49:09 andrew Exp $
1.1       andrew      3:
                      4: use Test::More tests => 3;
                      5: use File::Spec;
                      6:
                      7: BEGIN {
                      8:        use_ok( 'Net::Telnet::Trango' );
                      9: }
                     10:
                     11: diag("25: Parse linktest");
                     12:
                     13: my $linktest = <<'EOL';
                     14: [suid] 5 [pkt len] 1600 bytes [# of pkts per cycle] 500 [cycle] 5
                     15:
                     16: 0  [AP Tx] 500 [AP Rx] 500 [AP RxErr] 0  [SU Tx] 500 [SU Rx] 500 [SU RxErr] 0  1286 ms  9953 kbps
                     17: 1  [AP Tx] 500 [AP Rx] 500 [AP RxErr] 0  [SU Tx] 500 [SU Rx] 500 [SU RxErr] 0  1287 ms  9945 kbps
                     18: 2  [AP Tx] 500 [AP Rx] 500 [AP RxErr] 0  [SU Tx] 500 [SU Rx] 500 [SU RxErr] 0  1288 ms  9937 kbps
                     19: 3  [AP Tx] 500 [AP Rx] 500 [AP RxErr] 0  [SU Tx] 500 [SU Rx] 500 [SU RxErr] 0  1287 ms  9945 kbps
                     20: 4  [AP Tx] 500 [AP Rx] 500 [AP RxErr] 0  [SU Tx] 500 [SU Rx] 500 [SU RxErr] 0  1288 ms  9937 kbps
                     21:
                     22: [AP Total nTx]    5000 pkts
                     23: [AP Total nRx]    5000 pkts
                     24: [AP Total nRxErr] 0 pkts
                     25:
                     26: [SU Total nTx]    5000 pkts
                     27: [SU Total nRx]    5000 pkts
                     28: [SU Total nRxErr] 0 pkts
                     29:
                     30: [AP to SU Error Rate] 0.00 %
                     31: [SU to AP Error Rate] 0.00 %
                     32:
                     33: [Avg of Throughput]   9942 kbps
                     34: EOL
                     35:
                     36: $should_decode_to = {
                     37:     'tests' => [
                     38:     {
1.2     ! andrew     39:         'rate' => '9953 kbps',
1.1       andrew     40:         'SU Tx' => '500',
1.2     ! andrew     41:         'time' => '1286 ms',
        !            42:         'SU RxErr' => '0',
1.1       andrew     43:         'SU Rx' => '500',
                     44:         'AP Rx' => '500',
                     45:         'AP RxErr' => '0',
                     46:         'AP Tx' => '500'
                     47:     },
                     48:     {
1.2     ! andrew     49:         'rate' => '9945 kbps',
1.1       andrew     50:         'SU Tx' => '500',
1.2     ! andrew     51:         'time' => '1287 ms',
        !            52:         'SU RxErr' => '0',
1.1       andrew     53:         'SU Rx' => '500',
                     54:         'AP Rx' => '500',
                     55:         'AP RxErr' => '0',
                     56:         'AP Tx' => '500'
                     57:     },
                     58:     {
1.2     ! andrew     59:         'rate' => '9937 kbps',
1.1       andrew     60:         'SU Tx' => '500',
1.2     ! andrew     61:         'time' => '1288 ms',
        !            62:         'SU RxErr' => '0',
1.1       andrew     63:         'SU Rx' => '500',
                     64:         'AP Rx' => '500',
                     65:         'AP RxErr' => '0',
                     66:         'AP Tx' => '500'
                     67:     },
                     68:     {
1.2     ! andrew     69:         'rate' => '9945 kbps',
1.1       andrew     70:         'SU Tx' => '500',
1.2     ! andrew     71:         'time' => '1287 ms',
        !            72:         'SU RxErr' => '0',
1.1       andrew     73:         'SU Rx' => '500',
                     74:         'AP Rx' => '500',
                     75:         'AP RxErr' => '0',
                     76:         'AP Tx' => '500'
                     77:     },
                     78:     {
1.2     ! andrew     79:         'rate' => '9937 kbps',
1.1       andrew     80:         'SU Tx' => '500',
1.2     ! andrew     81:         'time' => '1288 ms',
        !            82:         'SU RxErr' => '0',
1.1       andrew     83:         'SU Rx' => '500',
                     84:         'AP Rx' => '500',
                     85:         'AP RxErr' => '0',
                     86:         'AP Tx' => '500'
                     87:     }
                     88:     ],
                     89:     'AP Total nTx' => '5000 pkts',
                     90:     'AP Total nRxErr' => '0 pkts',
                     91:     '# of pkts per cycle' => '500',
                     92:     'AP Total nRx' => '5000 pkts',
                     93:     'SU Total nRxErr' => '0 pkts',
                     94:     'SU to AP Error Rate' => '0.00 %',
                     95:     'AP to SU Error Rate' => '0.00 %',
                     96:     'suid' => '5',
                     97:     'SU Total nRx' => '5000 pkts',
                     98:     'SU Total nTx' => '5000 pkts',
                     99:     'Avg of Throughput' => '9942 kbps',
                    100:     'pkt len' => '1600 bytes',
                    101:     'cycle' => '5'
                    102: };
                    103:
                    104: my @linktest = split /\n/, $linktest;
                    105:
                    106: my $decoded;
                    107: ok($decoded = Net::Telnet::Trango::_decode_linktest(@linktest),
                    108:     "Decoding linktest");
                    109:
                    110: is_deeply($decoded, $should_decode_to, "Decoded information matches");

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>