<commit_before>package jp.hitting.svn_diff_browser.util

import jp.hitting.svn_diff_browser.model.DiffInfo
import org.junit.Assert
import org.junit.Test
import java.util.*

/**
 * DiffUtil Test.
 * Created by hitting on 2016/03/29.
 */
class DiffUtilTest {

    /**
     * {@link DiffUtil#parseDiff} test.
     */
    @Test
    fun testParseDiff() {
        // test data
        val diffStr = """
Index: hoge.txt
===================================================================
--- hoge.txt    (revision 4)
+++ hoge.txt    (revision 5)
@@ -2,6 +2,6 @@

fuga

-piyo
-
updated
+
+aaa
Index: dir/a.txt
===================================================================
--- dir/a.txt   (revision 4)
+++ dir/a.txt   (revision 5)
@@ -0,0 +1,5 @@
+aaaa
+
+bbbb
+
+cccc
""".trimMargin()

        // expected data

        var expectedList = ArrayList<DiffInfo>()
        val diff1 = DiffInfo()
        diff1.path = "hoge.txt"
        diff1.diff = """
--- hoge.txt    (revision 4)
+++ hoge.txt    (revision 5)
@@ -2,6 +2,6 @@

fuga

-piyo
-
updated
+
+aaa
""".trimMargin()
        expectedList.add(diff1)

        val diff2 = DiffInfo()
        diff2.path = "dir/a.txt"
        diff2.diff = """
--- dir/a.txt   (revision 4)
+++ dir/a.txt   (revision 5)
@@ -0,0 +1,5 @@
+aaaa
+
+bbbb
+
+cccc
""".trimMargin()
        expectedList.add(diff2)

        // execute
        val diffList = DiffUtil.parseDiff(diffStr.toByteArray())

        // assert
        Assert.assertEquals(expectedList.size, diffList.size)
        for (i in 0..expectedList.size) {
            val e = expectedList.get(i)
            val a = diffList.get(i)
            Assert.assertEquals(e.path, a.path)
            Assert.assertEquals(e.diff, a.diff)
        }<commit_msg>bug fix for test<commit_after>package jp.hitting.svn_diff_browser.util

import jp.hitting.svn_diff_browser.model.DiffInfo
import org.junit.Assert
import org.junit.Test
import java.util.*

/**
 * DiffUtil Test.
 * Created by hitting on 2016/03/29.
 */
class DiffUtilTest {

    /**
     * {@link DiffUtil#parseDiff} test.
     */
    @Test
    fun testParseDiff() {
        // test data
        val diffStr = """
Index: hoge.txt
===================================================================
--- hoge.txt    (revision 4)
+++ hoge.txt    (revision 5)
@@ -2,6 +2,6 @@

fuga

-piyo
-
updated
+
+aaa
Index: dir/a.txt
===================================================================
--- dir/a.txt   (revision 4)
+++ dir/a.txt   (revision 5)
@@ -0,0 +1,5 @@
+aaaa
+
+bbbb
+
+cccc
""".trimMargin()

        // expected data

        var expectedList = ArrayList<DiffInfo>()
        val diff1 = DiffInfo()
        diff1.path = "hoge.txt"
        diff1.diff = """
--- hoge.txt    (revision 4)
+++ hoge.txt    (revision 5)
@@ -2,6 +2,6 @@

fuga

-piyo
-
updated
+
+aaa
""".trimMargin()
        expectedList.add(diff1)

        val diff2 = DiffInfo()
        diff2.path = "dir/a.txt"
        diff2.diff = """
--- dir/a.txt   (revision 4)
+++ dir/a.txt   (revision 5)
@@ -0,0 +1,5 @@
+aaaa
+
+bbbb
+
+cccc
""".trimMargin()
        expectedList.add(diff2)

        // execute
        val diffList = DiffUtil.parseDiff(diffStr.toByteArray())

        // assert
        Assert.assertEquals(expectedList.size, diffList.size)
        for (i in 0..expectedList.size-1) {
            val e = expectedList.get(i)
            val a = diffList.get(i)
            Assert.assertEquals(e.path, a.path)
            Assert.assertEquals(e.diff, a.diff)
        }
{'fraction_non_alphanumeric': 0.2263445498993385, 'fraction_numerical': 0.02387115329306874, 'mean_word_length': 2.341018251681076, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6002895', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1200, 'n_words': 247}