From c2f96f372ee98b3745ad0c7f1dbb1a81ad7c4a7d Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Fri, 23 Mar 2018 16:09:10 +0100 Subject: [PATCH] Improve conversion tests --- .../nikiroo/fanfix/test/ConversionTest.java | 28 +++++++++++++----- test/expected/cbz.cbz | Bin 1383 -> 1385 bytes test/expected/epub.epub | Bin 6243 -> 6242 bytes test/expected/html/html.info | 4 +-- test/expected/html/html.txt | 6 ++-- test/expected/html/index.html | 6 ++-- test/expected/info_text | 4 +-- test/expected/info_text.info | 4 +-- test/expected/latex.tex | 4 +-- test/expected/text.txt | 6 ++-- test/test.story | 4 +-- 11 files changed, 40 insertions(+), 26 deletions(-) diff --git a/src/be/nikiroo/fanfix/test/ConversionTest.java b/src/be/nikiroo/fanfix/test/ConversionTest.java index 92aca36..d932782 100644 --- a/src/be/nikiroo/fanfix/test/ConversionTest.java +++ b/src/be/nikiroo/fanfix/test/ConversionTest.java @@ -6,7 +6,10 @@ import java.io.FilenameFilter; 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; @@ -25,6 +28,7 @@ class ConversionTest extends TestLauncher { private File expectedDir; private File resultDir; private List realTypes; + private Map> skipCompare; public ConversionTest(String[] args) { super("Conversion", args); @@ -69,6 +73,15 @@ class ConversionTest extends TestLauncher { resultDir = new File("test/result/"); tempFiles = new TempFiles("Fanfix-ConversionTest"); + + skipCompare = new HashMap>(); + skipCompare.put("epb.ncx", + Arrays.asList(" ", + " ")); + skipCompare.put(".info", + Arrays.asList("CREATION_DATE=", "SUBJECT=", "URL=", "UUID=")); + skipCompare.put("URL", Arrays.asList("file:/")); } @Override @@ -215,13 +228,14 @@ class ConversionTest extends TestLauncher { 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> skipThose : skipCompare + .entrySet()) { + for (String skipStart : skipThose.getValue()) { + if (name.endsWith(skipThose.getKey()) + && expectedLine.startsWith(skipStart) + && resultLine.startsWith(skipStart)) { + skip = true; + } } } diff --git a/test/expected/cbz.cbz b/test/expected/cbz.cbz index 30c6efc58717aed210708390700501a869b26065..3740e9226cb8b00e597326edc97c7dc516d951a9 100644 GIT binary patch delta 999 zcmaFP^^%Jxz?+#xgn@&DgTc6AB9ChQta)Dy8U>e6DtNKLV9G_-s9yD^WhuOyB{DX> z-T%E=x9a<)XHQ?huYMnzqLi*ESl#+|!R*5wzs1yhGo_scrY0ReJ;CGh%zqg#624~q zz1p>42G@dV>%Mygs9ry>Bc!-7Ym3589c8nX!Wxm!6f?g%vYy-bKdA5G+_JvE7kclX zU0zgwVA)mmbfxEy^S1mgQ1iI3g^TlnQTPAD&yCs5buUfOcrhtA^VBM1U$I+%!?@OXUaV#u*xU&EaQGvm{USJt*t)zUR>Wl@clOZ`Q`XtJXRq zR;6ie^0hBW?AA9{((}J8gDBsix9oyXED1ZrL&7ht^h| zSbuQ8aa`-6<3cYwE-tTU2F4*r)xKcc7GU)8F{4Fc0<#5^al_)!m=H zW|98R8J|CVHd$&CE?4m8{ll!=8|xKTtq7mSx+`i=h=@ah6klsJ57*A1xL^T(pAQDH zJl0PPHlLb&rcqhw)m(2y<&Pm(taN{I9PZh){q2;0AO~+=@os$=Fexnq;s9?(CJ_c$ wmMr%HrN_zfEP5b^_p|8pf|4NIgOg9QXn-WXvKWIU;08@LWz}KxWdS8s0PYFFasU7T delta 997 zcmaFK^_+_*z?+#xgn@&DgCQw;B9Cglhkw-!o(n5gY)h6JOu5J!)vMmLETtuq$K>X> z`@b8z@9o`E`SaKBd(~4{p0PMsv|iSF%h$w`U&lJLFJEC(UiHLHghl)E%zqg#5^i5) zTP^A)IMv~&_j|_0L2Kt*OlFC;jhf&j+T;I<#Yiu^(-I(3{tZvwzR-Ntm_t>9gl=S8FJ#UD@*KonVeF-_cPp?%lkW^Uqwgq#R!BzM1*+&)*8!79Dpv?w1blEqUkMNn6;TIsMCo zduiQA`5;hBHMLEB09gd~*DAZefxJw{PV3nctsWd}&%cHAiHlP}FY=o=K`R zrA^-7e%MXACI%vE;zLD{hhy78JSnQ z>J2+&7qPz36tFm@eaUCLKRlytI^CsOf4@pSuUf*ACdwU9pRw|r_oYhdRp+Pr$cXjWnw3es*E*7a ze_i<2vhsCXC;U4+yP`@=_ban_)r{;v2CJXFJ-^*9dP|_ych6aS&(8X06!ln*`#qOY zo#&5p6{21BQ&;%BG5jkGj6;rd?_;%EfYHazj249n%oa>Z(UWH}OV@AYWpdTcLd01h@M|ERb=1%?sZxI zwv{J39-A}bvW*(lD zW>~v{-ODX_ujkq~YZ$NAESAXB-cj7SPyPWv$hiwH)GY1*CZr`m9N^8!B*Fm8kmWw0 s)HpejMGxfci7fiOpacl_-sH0^8X$@9EXH67xIvT6S#{XFSwIOD0KeF|E&u=k diff --git a/test/expected/epub.epub b/test/expected/epub.epub index ea932ba19a632cbc533746fc7f290e75132d4757..1e3dd8cd04d20a61647a49cb92f26046ea73dede 100644 GIT binary patch delta 2246 zcmZWq3pkWnA0Ok>3?Xx8QcV)FWL$Pe<9=B?txyIkJbL;@MqKJlEz3B*akf4ZQ&c7jpX51Bu*h>r8TkLjdOx8D0B9x8FS9q zb;vLgb@R~8yQzxQDy@Os-H&Fk1%-Oz&q52cxp%(IZ|!Mx51qO;$^NdoL|bZU0W%sn z#}t%yG*hFZ+C>pi-1zUvsi@hHiPY? zut-#rj>f+16Gf(bHTPcpkrpX@sr7`}>i1{E^PzE^y)6uG8}wfO zxda4~D+z&Yl*c(5q@Dze0%ZX-z)7GwX5fb3)WIU|5BCcV@K18+WR4JJ#RBPEzUtT? zepf4Q7HTWwZ{CbaNC_zKY@DW6Xe%K{?ls47S0Y8Z4?npy_{B=ZQ!hkiWg!PY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5ZTD7L8UqcBS(Hu8)|;idJ!_Xc#5mb%WhbEXNM-7Nr0GB7 zx5yhjK*{UJnl7a|>kZVAiMJ~bhv8C&R96r1ri8+rMR1ELJ>bSzx`GgNxn95%TU;^= z4xW6V^yW_pKa>zy&#TjKV_Rw(PzczK&bNyKKX$%L;`*y=*p<`8(m#3 zIErp`Ujy@H^;~td`abpbq7VM*xfWq3knP2*oz645teCu8&zXcRD6QDg>9{72%H8-z z@7{s8^?f!g%BM%CJgQ$P-<-qt3*VOKQY?o~y|Vwn(+&P?7BbKtn3`u(cj&orhmi7! z<0RzBSzwMWP8CYU-61$?kR%~U;itC?fWob$O5O*@NnHZ`qtu;5m`dGs1Xk*L5!OIYYdQk}fJcGayq?wj<1#xeCjVTXSL5wPNo61jD77oRV>`~Uy| diff --git a/test/expected/html/html.info b/test/expected/html/html.info index 6831683..b1d1cde 100644 --- a/test/expected/html/html.info +++ b/test/expected/html/html.info @@ -13,6 +13,6 @@ TYPE="text" 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" diff --git a/test/expected/html/html.txt b/test/expected/html/html.txt index 4ff9013..a3a3af3 100644 --- a/test/expected/html/html.txt +++ b/test/expected/html/html.txt @@ -4,7 +4,7 @@ by UnknownArtist366 (2018) 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. @@ -12,8 +12,8 @@ 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 diff --git a/test/expected/html/index.html b/test/expected/html/index.html index 22b6eb0..aade9c3 100644 --- a/test/expected/html/index.html +++ b/test/expected/html/index.html @@ -17,7 +17,7 @@
UnknownArtist366


- 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.
@@ -31,8 +31,8 @@
— “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”.”
diff --git a/test/expected/info_text b/test/expected/info_text index e6c90d2..768b3cc 100644 --- a/test/expected/info_text +++ b/test/expected/info_text @@ -10,8 +10,8 @@ formats correctly. 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 diff --git a/test/expected/info_text.info b/test/expected/info_text.info index 5e97cce..38ae4b5 100644 --- a/test/expected/info_text.info +++ b/test/expected/info_text.info @@ -13,6 +13,6 @@ TYPE="info_text" 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" diff --git a/test/expected/latex.tex b/test/expected/latex.tex index 81909dd..d4dd68f 100644 --- a/test/expected/latex.tex +++ b/test/expected/latex.tex @@ -23,10 +23,10 @@ \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''.''} diff --git a/test/expected/text.txt b/test/expected/text.txt index 4ff9013..a3a3af3 100644 --- a/test/expected/text.txt +++ b/test/expected/text.txt @@ -4,7 +4,7 @@ by UnknownArtist366 (2018) 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. @@ -12,8 +12,8 @@ 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 diff --git a/test/test.story b/test/test.story index c3136a3..7365b60 100644 --- a/test/test.story +++ b/test/test.story @@ -9,8 +9,8 @@ formats correctly. 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 -- 2.27.0