@@ -0,0 +1,2496 @@
+/*%0A * Copyright 2020 The Apache Software Foundation.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.fontbox.cmap;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport org.junit.Test;%0A%0Apublic class CIDRangeTest%0A%7B%0A%0A    @Test%0A    public void testCIDRangeOneByte()%0A    %7B%0A        CIDRange cidRange = new CIDRange(0, 20, 65, 1);%0A        assertEquals(1, cidRange.getCodeLength());%0A%0A        assertEquals(65, cidRange.map(new byte%5B%5D %7B 0 %7D));%0A        assertEquals(75, cidRange.map(new byte%5B%5D %7B 10 %7D));%0A        // out of range%0A        assertEquals(-1, cidRange.map(new byte%5B%5D %7B 30 %7D));%0A        // wrong code length%0A        assertEquals(-1, cidRange.map(new byte%5B%5D %7B 0, 10 %7D));%0A%0A        assertEquals(65, cidRange.map(0, 1));%0A        assertEquals(75, cidRange.map(10, 1));%0A        // out of range%0A        assertEquals(-1, cidRange.map(30, 1));%0A        // wrong code length%0A        assertEquals(-1, cidRange.map(10, 2));%0A%0A        assertEquals(0, cidRange.unmap(65));%0A        assertEquals(10, cidRange.unmap(75));%0A        // out of range%0A        assertEquals(-1, cidRange.unmap(100));%0A    %7D%0A%0A    @Test%0A    public void testCIDRangeTwoByte()%0A    %7B%0A        CIDRange cidRange = new CIDRange(256, 280, 65, 2);%0A        assertEquals(2, cidRange.getCodeLength());%0A%0A        assertEquals(65, cidRange.map(new byte%5B%5D %7B 1, 0 %7D));%0A        assertEquals(75, cidRange.map(new byte%5B%5D %7B 1, 10 %7D));%0A        // out of range%0A        assertEquals(-1, cidRange.map(new byte%5B%5D %7B 1, 30 %7D));%0A        // wrong code length%0A        assertEquals(-1, cidRange.map(new byte%5B%5D %7B 10 %7D));%0A%0A        assertEquals(65, cidRange.map(256, 2));%0A        assertEquals(75, cidRange.map(266, 2));%0A        // out of range%0A        assertEquals(-1, cidRange.map(290, 2));%0A        // wrong code length%0A        assertEquals(-1, cidRange.map(256, 1));%0A%0A        assertEquals(256, cidRange.unmap(65));%0A        assertEquals(266, cidRange.unmap(75));%0A        // out of range%0A        assertEquals(-1, cidRange.unmap(100));%0A    %7D%0A%0A%7D%0A

add tests