@@ -0,0 +1,2725 @@
+/*%0A * #%25L%0A * ImageJ software for multidimensional image processing and analysis.%0A * %25%25%0A * Copyright (C) 2014 - 2016 Board of Regents of the University of%0A * Wisconsin-Madison, University of Konstanz and Brian Northan.%0A * %25%25%0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted provided that the following conditions are met:%0A * %0A * 1. Redistributions of source code must retain the above copyright notice,%0A *    this list of conditions and the following disclaimer.%0A * 2. Redistributions in binary form must reproduce the above copyright notice,%0A *    this list of conditions and the following disclaimer in the documentation%0A *    and/or other materials provided with the distribution.%0A * %0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22%0A * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE%0A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE%0A * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE%0A * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR%0A * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF%0A * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS%0A * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN%0A * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)%0A * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE%0A * POSSIBILITY OF SUCH DAMAGE.%0A * #L%25%0A */%0A%0Apackage net.imagej.ops.image.ascii;%0A%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport net.imagej.ops.AbstractOpTest;%0Aimport net.imglib2.img.Img;%0Aimport net.imglib2.img.array.ArrayImgs;%0Aimport net.imglib2.type.numeric.integer.UnsignedByteType;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * Tests %7B@link net.imagej.ops.Ops.Image.ASCII%7D.%0A * %0A * @author Leon Yang%0A */%0Apublic class ASCIITest extends AbstractOpTest %7B%0A%0A%09@Test%0A%09public void testDefaultASCII() %7B%0A%09%09// character set used in DefaultASCII, could be updated if necessary%0A%09%09final String CHARS = %22#O*o+-,. %22;%0A%09%09final int len = CHARS.length();%0A%09%09final int width = 10;%0A%09%09final int offset = 47;%0A%09%09final byte%5B%5D array = new byte%5Bwidth * len%5D;%0A%09%09for (int i = 0; i %3C len; i++) %7B%0A%09%09%09for (int j = 0; j %3C width; j++) %7B%0A%09%09%09%09array%5Bi * width + j%5D = (byte) (offset + i * width + j);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09final Img%3CUnsignedByteType%3E img = ArrayImgs.unsignedBytes(array, width,%0A%09%09%09len);%0A%09%09final String ascii = (String) ops.run(DefaultASCII.class, img);%0A%09%09for (int i = 0; i %3C len; i++) %7B%0A%09%09%09for (int j = 0; j %3C width; j++) %7B%0A%09%09%09%09assertTrue(ascii.charAt(i * (width + 1) + j) == CHARS.charAt(i));%0A%09%09%09%7D%0A%09%09%09assertTrue(ascii.charAt(i * (width + 1) + width) == '%5Cn');%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add ASCIITest