diff --git a/test/net/sourceforge/filebot/ui/rename/MatchSimilarityMetricTest.java b/test/net/sourceforge/filebot/ui/rename/MatchSimilarityMetricTest.java index 3fb9b29b..4dea4b5a 100644 --- a/test/net/sourceforge/filebot/ui/rename/MatchSimilarityMetricTest.java +++ b/test/net/sourceforge/filebot/ui/rename/MatchSimilarityMetricTest.java @@ -9,9 +9,24 @@ import java.io.File; import org.junit.Test; +import net.sourceforge.filebot.web.Date; +import net.sourceforge.filebot.web.Episode; + public class MatchSimilarityMetricTest { + @Test + public void substringMetrics() { + Episode eY1T1 = new Episode("Doctor Who", new Date(2005, 0, 0), 1, 1, "Rose"); + Episode eY2T2 = new Episode("Doctor Who", new Date(1963, 0, 0), 1, 1, "An Unearthly Child"); + File fY1T1 = new File("Doctor Who (2005)/Doctor Who - 1x01 - Rose"); + File fY2T2 = new File("Doctor Who (1963)/Doctor Who - 1x01 - An Unearthly Child"); + + assertEquals(3.0 / 3, Title.getSimilarity(eY1T1, fY1T1), 0); + assertEquals(2.0 / 3, Title.getSimilarity(eY1T1, fY2T2), 0.01); + } + + @Test public void nameIgnoreEmbeddedChecksum() { assertEquals(1, Name.getSimilarity("test", "test [EF62DF13]"), 0); diff --git a/website/index.html b/website/index.html index 48b7f3c7..94259fd2 100644 --- a/website/index.html +++ b/website/index.html @@ -147,7 +147,7 @@