|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | +package com.cloud.utils.net; |
| 18 | + |
| 19 | +import static org.junit.Assert.assertEquals; |
| 20 | + |
| 21 | +import org.junit.Test; |
| 22 | + |
| 23 | +public class IpTest { |
| 24 | + |
| 25 | + @Test |
| 26 | + public void testUltimate() { |
| 27 | + Ip max = new Ip(2L * Integer.MAX_VALUE +1 ); |
| 28 | + assertEquals("Maximal address not created", "255.255.255.255", max.addr()); |
| 29 | + } |
| 30 | + @Test |
| 31 | + public void testTurningOfTheCentury() { |
| 32 | + Ip eve = new Ip(Integer.MAX_VALUE); |
| 33 | + assertEquals("Minimal address not created", "127.255.255.255", eve.addr()); |
| 34 | + Ip dawn = new Ip(Integer.MAX_VALUE + 1L); |
| 35 | + assertEquals("Minimal address not created", "128.0.0.0", dawn.addr()); |
| 36 | + } |
| 37 | + @Test |
| 38 | + public void testStart() { |
| 39 | + Ip min = new Ip(0); |
| 40 | + assertEquals("Minimal address not created", "0.0.0.0", min.addr()); |
| 41 | + } |
| 42 | + |
| 43 | +} |
0 commit comments