summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Mackintosh <m@zyp.io>2015-03-23 16:55:21 -0400
committerMike Mackintosh <m@zyp.io>2015-03-23 16:55:21 -0400
commitad087f8fac02c9de49ef78263a376d20e442ac2a (patch)
tree15d77797a9b7137a5e3140d6e48b504bc6d94d10 /test
parent1f207635f6aa1672789902429cd877aaf843be93 (diff)
downloadipaddress-ad087f8fac02c9de49ef78263a376d20e442ac2a.tar.gz
added IPv4#[]= to fix #24
Diffstat (limited to 'test')
-rw-r--r--test/ipaddress/ipv4_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ipaddress/ipv4_test.rb b/test/ipaddress/ipv4_test.rb
index 9f92c94..19264e2 100644
--- a/test/ipaddress/ipv4_test.rb
+++ b/test/ipaddress/ipv4_test.rb
@@ -581,6 +581,20 @@ class IPv4Test < Minitest::Test
end
end
+ def test_octect_updates
+ ip = @klass.new("10.0.1.15/32")
+ ip[1] = 15
+ assert_equal "10.15.1.15/32", ip.to_string
+
+ ip = @klass.new("172.16.100.1")
+ ip[3] = 200
+ assert_equal "172.16.100.200/32", ip.to_string
+
+ ip = @klass.new("192.168.199.0/24")
+ ip[2] = 200
+ assert_equal "192.168.200.0/24", ip.to_string
+ end
+
end # class IPv4Test