1#!/usr/bin/env perl 2 3use strict; 4use warnings; 5 6BEGIN { $ENV{DANCER_ENVDIR} = '/dev/null'; } 7 8use Test::More 0.88; 9use Test::File::ShareDir::Dist { 'App-Netdisco' => 'share/' }; 10 11BEGIN { 12 use_ok( 'App::Netdisco::Util::Web', 'sort_port' ); 13} 14 15# 1 = first is greater 16# 0 = same 17# -1 = first is lesser 18 19is(sort_port(1,1), 0, 'number - same values'); 20is(sort_port('1:2','1:10'), -1, 'colon number (Extreme) - first lesser'); 21is(sort_port('D1','D10'), -1, 'HP - simple letter and number [#152]'); 22 23# Juniper examples for [#128] 24# https://www.juniper.net/documentation/en_US/junos14.2/topics/concept/interfaces-interface-naming-overview.html 25is(sort_port('so-1/0/0.0','so-1/0/1.0'), -1, 'juniper - FPC in slot 1 with OC3 PIC - 1'); 26is(sort_port('so-1/1/0.0','so-1/1/1.0'), -1, 'juniper - FPC in slot 1 with OC3 PIC - 2'); 27is(sort_port('so-1/0/0.0','so-1/1/0.0'), -1, 'juniper - FPC in slot 1 with OC3 PIC - 3'); 28 29is(sort_port('so-1/0/0:0','so-1/0/1:0'), -1, 'juniper - FPC in slot 1 with OC3 PIC channelized - 1'); 30is(sort_port('so-1/1/0:0','so-1/1/1:0'), -1, 'juniper - FPC in slot 1 with OC3 PIC channelized - 2'); 31is(sort_port('so-1/0/0:0','so-1/1/0:0'), -1, 'juniper - FPC in slot 1 with OC3 PIC channelized - 3'); 32 33done_testing; 34