// Path: bytecompressor-jsnappy/src/test/java/de/jarnbjo/jsnappy/TestUtil.java
// public class TestUtil {
// 
// 	public static byte[] readResource(String path) throws IOException {
// 		return readFully(TestUtil.class.getResourceAsStream(path));
// 	}
// 	
// 	public static byte[] readFully(InputStream is) throws IOException {
// 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
// 		pipe(is, baos);
// 		return baos.toByteArray();		
// 	}
// 	
// 	public static byte[] readFully(File f) throws IOException {
// 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
// 		FileInputStream fis = new FileInputStream(f);
// 		pipe(fis, baos);
// 		fis.close();
// 		return baos.toByteArray();		
// 	}
// 	
// 	public static void pipe(InputStream is, OutputStream os) throws IOException {
// 		byte[] buffer = new byte[65536];
// 		int r = 0;
// 		while((r=is.read(buffer))>=0) {
// 			os.write(buffer, 0, r);
// 		}
// 		os.flush();
// 	}
// 
// 	public static void writeFile(String filename, byte[] data) throws IOException {
// 		FileOutputStream fos = new FileOutputStream(filename);
// 		fos.write(data);
// 		fos.close();
// 	}
// 
// 	public static void deleteRecursive(File dir) {
// 		if(dir.exists() && dir.isDirectory()) {
// 			for(File f : dir.listFiles()) {
// 				if(f.isDirectory()) {
// 					deleteRecursive(f);
// 				}
// 				else {
// 					f.delete();
// 				}
// 			}
// 		}
// 	}
// 	
// 	public static void copyRecursive(File sourceDir, File targetDir) throws IOException {
// 		targetDir.mkdirs();
// 		for(File f : sourceDir.listFiles()) {
// 			if(f.isDirectory()) {
// 				copyRecursive(f, new File(targetDir, f.getName()));
// 			}
// 			else {
// 				FileInputStream fis = new FileInputStream(f);
// 				FileOutputStream fos = new FileOutputStream(new File(targetDir, f.getName()));			
// 				pipe(fis, fos);
// 				fis.close();
// 				fos.close();
// 			}
// 		}
// 	}
// 	
// 	public static String findSnzipExecutable() {
// 		for(File f : new File("bin").listFiles()) {
// 			if(f.getName().equals("snzip") || f.getName().startsWith("snzip.")) {
// 				return new File(new File("bin"), f.getName()).getAbsolutePath();
// 			}
// 		}
// 		return null;
// 	}
// 	
// 	public static File directoriesToFile(String ... directoryNames) {
// 		if(directoryNames.length == 0) {
// 			throw new IllegalArgumentException("No directory names");
// 		}
// 		File f = null;
// 		for(String dn : directoryNames) {
// 			f = f == null ? new File(dn) : new File(f, dn);
// 		}
// 		return f;
// 	}
// 	
//   static public List<String> snzipArgs(String snzipExecutable, String argsStr, File testdataDirectory){
//     List<String> args = new LinkedList<String>();
//     args.add(snzipExecutable);
//     args.addAll(Arrays.asList(argsStr.split(" "))); //  -t name  file format name. see below. The default format is framing2.
//     for (File f : testdataDirectory.listFiles()) {
//       if (!f.isFile())
//         continue;
//       if (f.getName().startsWith(".")) // hidden file
//         continue;
//       args.add(f.getName());
//     }
//     return args;
//   }
//   
// }


import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import de.jarnbjo.jsnappy.SnzOutputStream;
import de.jarnbjo.jsnappy.TestUtil;

		
		if(!testdataDirectory.exists() || !testdataDirectory.isDirectory() || testdataDirectory.listFiles().length == 0) {
			throw new IllegalStateException("Test data directory \"" + testdataDirectory.getAbsolutePath() + " does not exist, is not a directory or is empty");
		}

		TestUtil.deleteRecursive(new File("tmp"));
	}
	
	@AfterClass
	public static void cleanup() {
		TestUtil.deleteRecursive(new File("tmp"));
	}
	
	@Test
	public void testSnzOutputStream_001() throws IOException, InterruptedException {
		testInternal(1);
	}
	
	@Test
	public void testSnzOutputStream_050() throws IOException, InterruptedException {
		testInternal(50);
	}

	@Test
	public void testSnzOutputStream_100() throws IOException, InterruptedException {
		testInternal(100);
	}

	public void testInternal(int effort) throws IOException, InterruptedException {


// Path: bytecompressor-jsnappy/src/test/java/de/jarnbjo/jsnappy/TestUtil.java
// public class TestUtil {
// 
// 	public static byte[] readResource(String path) throws IOException {
// 		return readFully(TestUtil.class.getResourceAsStream(path));
// 	}
// 	
// 	public static byte[] readFully(InputStream is) throws IOException {
// 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
// 		pipe(is, baos);
// 		return baos.toByteArray();		
// 	}
// 	
// 	public static byte[] readFully(File f) throws IOException {
// 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
// 		FileInputStream fis = new FileInputStream(f);
// 		pipe(fis, baos);
// 		fis.close();
// 		return baos.toByteArray();		
// 	}
// 	
// 	public static void pipe(InputStream is, OutputStream os) throws IOException {
// 		byte[] buffer = new byte[65536];
// 		int r = 0;
// 		while((r=is.read(buffer))>=0) {
// 			os.write(buffer, 0, r);
// 		}
// 		os.flush();
// 	}
// 
// 	public static void writeFile(String filename, byte[] data) throws IOException {
// 		FileOutputStream fos = new FileOutputStream(filename);
// 		fos.write(data);
// 		fos.close();
// 	}
// 
// 	public static void deleteRecursive(File dir) {
// 		if(dir.exists() && dir.isDirectory()) {
// 			for(File f : dir.listFiles()) {
// 				if(f.isDirectory()) {
// 					deleteRecursive(f);
// 				}
// 				else {
// 					f.delete();
// 				}
// 			}
// 		}
// 	}
// 	
// 	public static void copyRecursive(File sourceDir, File targetDir) throws IOException {
// 		targetDir.mkdirs();
// 		for(File f : sourceDir.listFiles()) {
// 			if(f.isDirectory()) {
// 				copyRecursive(f, new File(targetDir, f.getName()));
// 			}
// 			else {
// 				FileInputStream fis = new FileInputStream(f);
// 				FileOutputStream fos = new FileOutputStream(new File(targetDir, f.getName()));			
// 				pipe(fis, fos);
// 				fis.close();
// 				fos.close();
// 			}
// 		}
// 	}
// 	
// 	public static String findSnzipExecutable() {
// 		for(File f : new File("bin").listFiles()) {
// 			if(f.getName().equals("snzip") || f.getName().startsWith("snzip.")) {
// 				return new File(new File("bin"), f.getName()).getAbsolutePath();
// 			}
// 		}
// 		return null;
// 	}
// 	
// 	public static File directoriesToFile(String ... directoryNames) {
// 		if(directoryNames.length == 0) {
// 			throw new IllegalArgumentException("No directory names");
// 		}
// 		File f = null;
// 		for(String dn : directoryNames) {
// 			f = f == null ? new File(dn) : new File(f, dn);
// 		}
// 		return f;
// 	}
// 	
//   static public List<String> snzipArgs(String snzipExecutable, String argsStr, File testdataDirectory){
//     List<String> args = new LinkedList<String>();
//     args.add(snzipExecutable);
//     args.addAll(Arrays.asList(argsStr.split(" "))); //  -t name  file format name. see below. The default format is framing2.
//     for (File f : testdataDirectory.listFiles()) {
//       if (!f.isFile())
//         continue;
//       if (f.getName().startsWith(".")) // hidden file
//         continue;
//       args.add(f.getName());
//     }
//     return args;
//   }
//   
// }


// Path: bytecompressor-jsnappy/src/test/java/de/jarnbjo/jsnappy/withdata/SnzOutputStreamTest.java
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import de.jarnbjo.jsnappy.SnzOutputStream;
import de.jarnbjo.jsnappy.TestUtil;

		
		if(!testdataDirectory.exists() || !testdataDirectory.isDirectory() || testdataDirectory.listFiles().length == 0) {
			throw new IllegalStateException("Test data directory \"" + testdataDirectory.getAbsolutePath() + " does not exist, is not a directory or is empty");
		}

		TestUtil.deleteRecursive(new File("tmp"));
	}
	
	@AfterClass
	public static void cleanup() {
		TestUtil.deleteRecursive(new File("tmp"));
	}
	
	@Test
	public void testSnzOutputStream_001() throws IOException, InterruptedException {
		testInternal(1);
	}
	
	@Test
	public void testSnzOutputStream_050() throws IOException, InterruptedException {
		testInternal(50);
	}

	@Test
	public void testSnzOutputStream_100() throws IOException, InterruptedException {
		testInternal(100);
	}

	public void testInternal(int effort) throws IOException, InterruptedException {


		File tmpDirectory = TestUtil.directoriesToFile("tmp", "SnzOutputStreamTest");
