File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -481,15 +481,16 @@ def test_method_split
481481 end
482482
483483 def test_method_subnet
484- assert_raises ( ArgumentError ) { @network . subnet ( 23 ) }
485- assert_raises ( ArgumentError ) { @network . subnet ( 33 ) }
486- arr = [ "172.16.10.0/26" , "172.16.10.64/26" , "172.16.10.128/26" ,
487- "172.16.10.192/26" ]
488- assert_equal arr , @network . subnet ( 26 ) . map { |s | s . to_string }
489- arr = [ "172.16.10.0/25" , "172.16.10.128/25" ]
490- assert_equal arr , @network . subnet ( 25 ) . map { |s | s . to_string }
491- arr = [ "172.16.10.0/24" ]
492- assert_equal arr , @network . subnet ( 24 ) . map { |s | s . to_string }
484+ end
485+
486+ def test_method_subtract
487+ a = IPAddress '10.0.0.0/16'
488+ b = IPAddress '10.0.128.0/18'
489+ c = IPAddress '192.168.0.0/16'
490+
491+ assert !a . subtract ( b ) . include? ( b )
492+ assert b . subtract ( a ) . empty?
493+ assert_equal a , a . subtract ( c ) . first
493494 end
494495
495496 def test_method_supernet
You can’t perform that action at this time.
0 commit comments