# coding: utf-8
import six
from unittest import TestCase
from dsfp.tools import BinDiff

__all__ = ['TestBinDiff', ]


class TestBinDiff(TestCase):
    """Tools tests """
    maxDiff = None
    diff_a = six.b('\x00\x01\x00\x04\x44\x53\x60\x34\x90\x88\x13\x08')
    diff_b = six.b('\x01\x00\x00\x04\x42\x53\x61\x34\x93\x88\x13\x08')
    skip_table = {}
    diff = [
        {'diff': [0, 1], 'offset': 0},
        {'diff': [0, 2], 'offset': 4},
        {'diff': [0], 'offset': 8}
    ]

    def setUp(self):
        pass

    def test_bin_diff_match(self):
        diff_obj = BinDiff(self.diff_a, self.diff_b)
        diff = diff_obj.process_diff()
        self.assertEqual(diff, self.diff)
@@ -346,62 +346,229 @@
 e = 
-%7B%7D%0A    diff = %5B%0A        %7B'diff': %5B0, 1%5D, 'offset': 0%7D,
+%5B%0A        %7B%22comment%22: %22unknown data%22, %22offset%22: 0, %22size%22: 2%7D,%0A    %5D%0A    diff = %5B%0A        %7B'diff': %5B0, 1%5D, 'offset': 0%7D,%0A        %7B'diff': %5B0, 2%5D, 'offset': 4%7D,%0A        %7B'diff': %5B0%5D, 'offset': 8%7D%0A    %5D%0A    diff_patched = %5B
 %0A   
@@ -848,8 +848,247 @@
 lf.diff)
+%0A%0A    def test_bin_diff_patch_table(self):%0A        diff_obj = BinDiff(self.diff_a, self.diff_b,%0A                           skip_table=self.skip_table)%0A        diff = diff_obj.process_diff()%0A        self.assertEqual(diff, self.diff_patched)

update diff tests