import java.io.*;


   public class Test {
   /**
    * Test on the corpus...
    */
   
      static long original_file_size = 0;
      static long compressed_file_size = 0;
   
      public static void main(String[] args) throws IOException {
         test();
         measureFileSizes();
      
         do { } while (true);
      }
   
      public static void test() throws IOException {
         test("bib");
         test("book1");
         test("book2");
         test("geo");
         test("news");
         test("obj1");
         test("obj2");
         test("paper1");
         test("paper2");
         test("paper3");
         test("paper4");
         test("paper5");
         test("paper6");
         test("pic");
         test("progc");
         test("progl");
         test("progp");
         test("trans");
      }
   
   
      public static void measureFileSizes() throws IOException {
         original_file_size = 0;
         compressed_file_size = 0;
      
         addFileSize("bib");
         addFileSize("book1");
         addFileSize("book2");
         addFileSize("geo");
         addFileSize("news");
         addFileSize("obj1");
         addFileSize("obj2");
         addFileSize("paper1");
         addFileSize("paper2");
         addFileSize("paper3");
         addFileSize("paper4");
         addFileSize("paper5");
         addFileSize("paper6");
         addFileSize("pic");
         addFileSize("progc");
         addFileSize("progl");
         addFileSize("progp");
         addFileSize("trans");
      
         debug("Total original file sizes:" + original_file_size);
         debug("Total compressed file sizes:" + compressed_file_size);
         debug("Ratio:" + (((original_file_size - compressed_file_size) * 10000L) / original_file_size) / 100F);
      }
   
   
      public static void test(String f) throws IOException {
         RLE ca = new RLE();
         ca.compress("corpus\\" + f, "corpus\\z" + f);
      }
   
      public static void addFileSize(String f) {
         File h = new File("corpus\\" + f);
         original_file_size += h.length();
      
         File g = new File("corpus\\z" + f);
         compressed_file_size += g.length();
      }
   
      public static void debug(String s) {
         System.out.println(s);
      }
   
   
      public static void testUN(String f) throws IOException {
         UNRLE ca = new UNRLE();
         ca.decompress("corpus\\z" + f, "corpus\\y" + f);
      }
   
   }