import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
private File expectedDir;
private File resultDir;
private List<BasicOutput.OutputType> realTypes;
+ private Map<String, List<String>> skipCompare;
public ConversionTest(String[] args) {
super("Conversion", args);
resultDir = new File("test/result/");
tempFiles = new TempFiles("Fanfix-ConversionTest");
+
+ skipCompare = new HashMap<String, List<String>>();
+ skipCompare.put("epb.ncx",
+ Arrays.asList(" <meta name=\"dtb:uid\" content="));
+ skipCompare.put("epb.opf", Arrays.asList(" <dc:subject>",
+ " <dc:identifier id=\"BookId\" opf:scheme=\"URI\">"));
+ skipCompare.put(".info",
+ Arrays.asList("CREATION_DATE=", "SUBJECT=", "URL=", "UUID="));
+ skipCompare.put("URL", Arrays.asList("file:/"));
}
@Override
String resultLine = resultLines.get(j);
boolean skip = false;
- for (String skipStart : new String[] { "CREATION_DATE=",
- "SUBJECT=", "URL=", "UUID=" }) {
- if (name.endsWith(".info")
- && expectedLine.startsWith(skipStart)
- && resultLine.startsWith(skipStart)) {
- // TODO: check the format?
- skip = true;
+ for (Entry<String, List<String>> skipThose : skipCompare
+ .entrySet()) {
+ for (String skipStart : skipThose.getValue()) {
+ if (name.endsWith(skipThose.getKey())
+ && expectedLine.startsWith(skipStart)
+ && resultLine.startsWith(skipStart)) {
+ skip = true;
+ }
}
}
COVER=""
EPUBCREATOR="Fanfix (by Niki)"
PUBLISHER=""
-WORDCOUNT="59"
-CREATION_DATE="2018-03-23 11:27:04"
+WORDCOUNT="57"
+CREATION_DATE="2018-03-23 16:01:39"
FAKE_COVER="false"
Chapter 0: Description
——————————————————————
-This `story‘ is nothing more than a test file to check
+This ‘story’ is nothing more than a test file to check
that the program can convert it into different
formats correctly.
—————————————————
“Yes, quotes!”, I said.
-`Thos can start with a single- or double quote sign‘, I continued.
-“ They also supports other characters, and an optionnal leading dash. ”
+‘Those can start with a single- or double quote sign’, I continued.
+“They also supports other characters, and an optionnal leading dash.”
“The optionnal leading dash is enough to signify “quote”.”
Chapter 2: “Quote” test
<div class="author">UnknownArtist366</div>
</div>
<hr/><br/> <div class='normals'>
- <span class='normal'>This `story‘ is nothing more than a test file to check</span>
+ <span class='normal'>This ‘story’ is nothing more than a test file to check</span>
<span class='normal'>that the program can convert it into different</span>
<span class='normal'>formats correctly.</span>
</div>
<div class='chapter_content'>
<div class='dialogues'>
<div class='dialogue'>— “Yes, quotes!”, I said.</div>
- <div class='dialogue'>— `Thos can start with a single- or double quote sign‘, I continued.</div>
- <div class='dialogue'>— “ They also supports other characters, and an optionnal leading dash. ”</div>
+ <div class='dialogue'>— ‘Those can start with a single- or double quote sign’, I continued.</div>
+ <div class='dialogue'>— “They also supports other characters, and an optionnal leading dash.”</div>
<div class='dialogue'>— “The optionnal leading dash is enough to signify “quote”.”</div>
</div>
Chapter 1: Quotes
"Yes, quotes!", I said.
-'Thos can start with a single- or double quote sign', I continued.
-" They also supports other characters, and an optionnal leading dash. "
+'Those can start with a single- or double quote sign', I continued.
+"They also supports other characters, and an optionnal leading dash."
"The optionnal leading dash is enough to signify "quote"."
Chapter 2: “Quote” test
COVER=""
EPUBCREATOR="Fanfix (by Niki)"
PUBLISHER=""
-WORDCOUNT="59"
-CREATION_DATE="2018-03-23 11:27:04"
+WORDCOUNT="57"
+CREATION_DATE="2018-03-23 16:01:39"
FAKE_COVER="false"
\say{``Yes, quotes!'', I said.}
-\say{`Thos can start with a single- or double quote sign', I continued.}
+\say{`Those can start with a single- or double quote sign', I continued.}
\noindent{}
-\say{`` They also supports other characters, and an optionnal leading dash. ''}
+\say{``They also supports other characters, and an optionnal leading dash.''}
\noindent{}
\say{``The optionnal leading dash is enough to signify ``quote''.''}
Chapter 0: Description
——————————————————————
-This `story‘ is nothing more than a test file to check
+This ‘story’ is nothing more than a test file to check
that the program can convert it into different
formats correctly.
—————————————————
“Yes, quotes!”, I said.
-`Thos can start with a single- or double quote sign‘, I continued.
-“ They also supports other characters, and an optionnal leading dash. ”
+‘Those can start with a single- or double quote sign’, I continued.
+“They also supports other characters, and an optionnal leading dash.”
“The optionnal leading dash is enough to signify “quote”.”
Chapter 2: “Quote” test
Chapter 1: Quotes
- "Yes, quotes!", I said.
-'Thos can start with a single- or double quote sign', I continued.
-- « They also supports other characters, and an optionnal leading dash. »
+'Those can start with a single- or double quote sign', I continued.
+- «They also supports other characters, and an optionnal leading dash.»
- The optionnal leading dash is enough to signify "quote".
Chapter 2: "Quote" test