Permalink
Browse files

do not consider /32 address as being a network address

  • Loading branch information...
1 parent 10c9350 commit 759ab15213b99c0955bfe264ad0f2729b2bd4886 Julien Ammous committed Jun 28, 2011
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/ipaddress/ipv4.rb
  2. +5 −0 test/ipaddress/ipv4_test.rb
View
@@ -311,7 +311,7 @@ def broadcast
# #=> true
#
def network?
- @u32 | @prefix.to_u32 == @prefix.to_u32
+ (@prefix < 32) && (@u32 | @prefix.to_u32 == @prefix.to_u32)
end
#
@@ -144,6 +144,11 @@ def test_method_network?
assert_equal true, @network.network?
assert_equal false, @ip.network?
end
+
+ def test_one_address_network
+ network = @klass.new("172.16.10.1/32")
+ assert_equal false, network.network?
+ end
def test_method_broadcast
@broadcast.each do |addr,bcast|

0 comments on commit 759ab15

Please sign in to comment.