prepare for unit tests

This commit is contained in:
umjammer 2019-07-08 23:26:33 +09:00
parent 5a9ac804a2
commit 9f21bf5d1d
8 changed files with 184 additions and 61 deletions

14
pom.xml
View File

@ -32,4 +32,18 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -449,27 +449,6 @@ public class BinHex4InputStream extends InputStream {
return (fl1 << 8) | fl2;
}
public static void main(String[] args)
{
try (BinHex4InputStream in = new BinHex4InputStream(System.in)) {
System.err.println(in.getHeader());
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while(true)
{
int r = in.read(buf);
if(r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch(IOException e)
{
e.printStackTrace();
}
}
/**
One of three states: before header, in data fork, or in resource fork.
*/

View File

@ -298,26 +298,6 @@ public class Hqx7_to_Hqx8InputStream extends FilterInputStream {
return len;
}
public static void main(String[] args)
{
try (InputStream in = new Hqx7_to_Hqx8InputStream(System.in)) {
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while(true)
{
int r = in.read(buf);
if(r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch(IOException e)
{
e.printStackTrace();
}
}
/**
A buffer for a maximum of two times six bits.
*/

View File

@ -254,26 +254,6 @@ public class RLE_CRCInputStream extends FilterInputStream {
return len;
}
public static void main(String[] args)
{
try (InputStream in = new RLE_CRCInputStream(System.in)) {
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while(true)
{
int r = in.read(buf);
if(r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch(IOException e)
{
e.printStackTrace();
}
}
/**
True if private method nextDecodedByte is still repeating a character
that was part of a Run-Length Encoding sequence.

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2019 by Naohide Sano, All rights reserved.
*
* Programmed by Naohide Sano
*/
package org.gjt.convert.binhex;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* BinHex4InputStreamTest.
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (umjammer)
* @version 0.00 2019/06/11 umjammer initial version <br>
*/
class BinHex4InputStreamTest {
@Test
void test() {
fail("Not yet implemented");
}
public static void main(String[] args) {
try (BinHex4InputStream in = new BinHex4InputStream(System.in)) {
System.err.println(in.getHeader());
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while (true) {
int r = in.read(buf);
if (r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/* */

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2019 by Naohide Sano, All rights reserved.
*
* Programmed by Naohide Sano
*/
package org.gjt.convert.binhex;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* DeBinHexTest.
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (umjammer)
* @version 0.00 2019/06/11 umjammer initial version <br>
*/
class DeBinHexTest {
@Test
void test() {
fail("Not yet implemented");
}
}
/* */

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2019 by Naohide Sano, All rights reserved.
*
* Programmed by Naohide Sano
*/
package org.gjt.convert.binhex;
import java.io.IOException;
import java.io.InputStream;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* Hqx7_to_Hqx8InputStreamTest.
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (umjammer)
* @version 0.00 2019/06/11 umjammer initial version <br>
*/
class Hqx7_to_Hqx8InputStreamTest {
@Test
void test() {
fail("Not yet implemented");
}
public static void main(String[] args) {
try (InputStream in = new Hqx7_to_Hqx8InputStream(System.in)) {
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while (true) {
int r = in.read(buf);
if (r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/* */

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2019 by Naohide Sano, All rights reserved.
*
* Programmed by Naohide Sano
*/
package org.gjt.convert.binhex;
import java.io.IOException;
import java.io.InputStream;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* RLE_CRCInputStreamTest.
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (umjammer)
* @version 0.00 2019/06/11 umjammer initial version <br>
*/
class RLE_CRCInputStreamTest {
@Test
void test() {
fail("Not yet implemented");
}
public static void main(String[] args) {
try (InputStream in = new RLE_CRCInputStream(System.in)) {
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while (true) {
int r = in.read(buf);
if (r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/* */