Wrum, wrum, wrum. Some silly tests.
parent
c3df7b0c97
commit
1bdd410a39
|
@ -30,6 +30,27 @@ dist.jar=${dist.dir}/MobiReader.jar
|
|||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.antlr-2.7.7.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/antlr-2.7.7.jar
|
||||
file.reference.antlr-3.0.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/antlr-3.0.jar
|
||||
file.reference.asm-1.5.3.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/asm-1.5.3.jar
|
||||
file.reference.avalon-framework-4.1.3.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/avalon-framework-4.1.3.jar
|
||||
file.reference.backport-util-concurrent-3.0.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/backport-util-concurrent-3.0.jar
|
||||
file.reference.cglib-2.1_3.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/cglib-2.1_3.jar
|
||||
file.reference.commons-io-1.2.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/commons-io-1.2.jar
|
||||
file.reference.commons-io-1.3.1.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/commons-io-1.3.1.jar
|
||||
file.reference.commons-logging-1.1.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/commons-logging-1.1.jar
|
||||
file.reference.guava-14.0.1.jar=/home/att/studia/semestr4/Java/compression/guava-14.0.1.jar
|
||||
file.reference.limbo-1.1-20081112.085229-2.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/limbo-1.1-20081112.085229-2.jar
|
||||
file.reference.log4j-1.2.12.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/log4j-1.2.12.jar
|
||||
file.reference.logkit-1.0.1.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/logkit-1.0.1.jar
|
||||
file.reference.pecia-1.0-20081112.075516-1.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/pecia-1.0-20081112.075516-1.jar
|
||||
file.reference.preon-binding-1.0-SNAPSHOT.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/preon-binding-1.0-SNAPSHOT.jar
|
||||
file.reference.preon-bitbuffer-1.0-SNAPSHOT.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/preon-bitbuffer-1.0-SNAPSHOT.jar
|
||||
file.reference.preon-bitbuffer-1.0-SNAPSHOT.jar-1=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/preon-bitbuffer-1.0-SNAPSHOT.jar
|
||||
file.reference.servlet-api-2.3.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/servlet-api-2.3.jar
|
||||
file.reference.stax-api-1.0.1.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/stax-api-1.0.1.jar
|
||||
file.reference.stringtemplate-3.0.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/stringtemplate-3.0.jar
|
||||
file.reference.wstx-asl-3.2.1.jar=/home/att/studia/semestr4/Java/resources/preon-1.0-SNAPSHOT/lib/ext/wstx-asl-3.2.1.jar
|
||||
includes=**
|
||||
# Non-JavaFX jar file creation is deactivated in JavaFX 2.0+ projects
|
||||
jar.archive.disabled=true
|
||||
|
@ -38,7 +59,28 @@ javac.classpath=\
|
|||
${javafx.runtime}/lib/jfxrt.jar:\
|
||||
${javafx.runtime}/lib/deploy.jar:\
|
||||
${javafx.runtime}/lib/javaws.jar:\
|
||||
${javafx.runtime}/lib/plugin.jar
|
||||
${javafx.runtime}/lib/plugin.jar:\
|
||||
${file.reference.guava-14.0.1.jar}:\
|
||||
${file.reference.preon-binding-1.0-SNAPSHOT.jar}:\
|
||||
${file.reference.preon-bitbuffer-1.0-SNAPSHOT.jar}:\
|
||||
${file.reference.antlr-2.7.7.jar}:\
|
||||
${file.reference.antlr-3.0.jar}:\
|
||||
${file.reference.asm-1.5.3.jar}:\
|
||||
${file.reference.avalon-framework-4.1.3.jar}:\
|
||||
${file.reference.backport-util-concurrent-3.0.jar}:\
|
||||
${file.reference.cglib-2.1_3.jar}:\
|
||||
${file.reference.commons-io-1.2.jar}:\
|
||||
${file.reference.commons-io-1.3.1.jar}:\
|
||||
${file.reference.commons-logging-1.1.jar}:\
|
||||
${file.reference.limbo-1.1-20081112.085229-2.jar}:\
|
||||
${file.reference.log4j-1.2.12.jar}:\
|
||||
${file.reference.logkit-1.0.1.jar}:\
|
||||
${file.reference.pecia-1.0-20081112.075516-1.jar}:\
|
||||
${file.reference.preon-bitbuffer-1.0-SNAPSHOT.jar-1}:\
|
||||
${file.reference.servlet-api-2.3.jar}:\
|
||||
${file.reference.stax-api-1.0.1.jar}:\
|
||||
${file.reference.stringtemplate-3.0.jar}:\
|
||||
${file.reference.wstx-asl-3.2.1.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package tests;
|
||||
|
||||
import java.io.File;
|
||||
import mobireader.Header;
|
||||
import mobireader.Mobi;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author att
|
||||
*/
|
||||
public class HeaderJUnitTest {
|
||||
|
||||
public HeaderJUnitTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() {
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
// TODO add test methods here.
|
||||
// The methods must be annotated with annotation @Test. For example:
|
||||
//
|
||||
@Test
|
||||
public void testCaluculationOfHeaderSize() {
|
||||
Mobi mobi = new Mobi("test");
|
||||
String header_format = "32shhIIIIII4s4sIIH";
|
||||
int correct_size = 78;
|
||||
int calculated_size = mobi.calcsize(header_format);
|
||||
assertEquals("Calculated size is incorrect", correct_size,
|
||||
calculated_size);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreatingHeaderByPreon() {
|
||||
Mobi mobi = new Mobi("test");
|
||||
String path = "/home/att/studia/semestr4/Java/resources/test.mobi";
|
||||
File file = new File(path);
|
||||
Header header = mobi.createHeaderBasedOn(file) ;
|
||||
System.out.println(header.name);
|
||||
assertTrue(header.name.length() != 0);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,12 +1,17 @@
|
|||
package tests;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Scanner;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
public class UnzippingJUnitTest {
|
||||
|
||||
|
@ -30,13 +35,40 @@ public class UnzippingJUnitTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBullshit() {
|
||||
assertEquals("10 equals 11", 10, 11);
|
||||
public void testIfCompressionIsShorter() {
|
||||
String text = "aaabbbaaacaccbbaaabbbaaacaccbbaaabbbaaacaccbb";
|
||||
String compressed = unzipping.LZ77.compressStr(text);
|
||||
assertTrue("compressed file is longer than before compression",
|
||||
compressed.length() <= text.length());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTruth() {
|
||||
assertEquals("10 does not equal 10", 10, 10);
|
||||
public void testHowDecompressedMobiLooksLike() throws FileNotFoundException, IOException {
|
||||
|
||||
String path = "/home/att/studia/semestr4/Java/resources/test.mobi";
|
||||
byte compressed [] = Files.toByteArray(new File(path));
|
||||
String compressedText = "";
|
||||
for(int i = 0; i < 40000; i++)
|
||||
{
|
||||
compressedText += (char)compressed[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testHowCompressedMobiLooksLike() throws FileNotFoundException, IOException {
|
||||
String path = "/home/att/studia/semestr4/Java/resources/test.mobi";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfDecompressionInvertCompression() {
|
||||
String text = "aaabbbaaacaccbbaaabbbaaacaccbbaaabbbaaacaccbb";
|
||||
String compressed = unzipping.LZ77.compressStr(text);
|
||||
String decompressed = unzipping.LZ77.decompressStr(compressed);
|
||||
assertEquals("Decompression does not invert compression",
|
||||
text, decompressed);
|
||||
}
|
||||
// TODO add test methods here.
|
||||
// The methods must be annotated with annotation @Test. For example:
|
||||
|
|
Loading…
Reference in New Issue