예제 #1
0
  @Test
  /* Structural Basis, Nominal Case */
  public void testCompression() {
    Segmentator segmentator = new Segmentator(3, "test.txt");
    List<Integer> actualList = segmentator.compression();
    List<Integer> expectedList = new ArrayList<Integer>();
    expectedList.add(0);
    expectedList.add(1);
    expectedList.add(2);
    expectedList.add(3);
    expectedList.add(4);
    expectedList.add(3);
    expectedList.add(4);
    expectedList.add(1);
    expectedList.add(5);
    expectedList.add(3);
    expectedList.add(2);
    expectedList.add(3);
    expectedList.add(1);
    expectedList.add(6);
    expectedList.add(7);
    expectedList.add(8);

    assertEquals(expectedList, actualList);
  }
예제 #2
0
  @Test
  /* Structural Basis */
  public void testCompressEmptyFile() {
    Segmentator segmentator = new Segmentator(1, "emptyFile.txt");
    // Compressing an empty file should return an empty compressed list.
    List<Integer> actualList = segmentator.compression();
    List<Integer> expectedList = new ArrayList<Integer>();

    assertEquals(expectedList, actualList);
  }
예제 #3
0
 @Test
 /* Stress Test */
 public void testSegmentStringStress() {
   Segmentator segmentator = new Segmentator(5, "Frankenstein.txt");
   segmentator.compression();
 }