import unittest
import manage_sys_paths
import json

from initialdemo.HyperGraph import HyperGraph

class Test_HyperGraph(unittest.TestCase):
    hypergraph: HyperGraph = None

    def setUp(self):
        self.hypergraph = HyperGraph()

    def test_removeDuplicates_noDupOrdered_sameContent(self):
        list_ = [[1,2,3]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual(list_, set_)

    def test_removeDuplicates_oneDupOrdered_removed(self):
        list_ = [[1,2,3,3]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual([[1,2,3]], set_)

    def test_removeDuplicates_multDupOrdered_allRemoved(self):
        list_ = [[1,1,2,3,3,4]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual([[1,2,3,4]], set_)

    def test_removeDuplicates_noDupUnordered_sameContent(self):
        list_ = [[1,2,3,5,9,4,30,15]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual(list_, set_)

    def test_removeDuplicates_oneDupUnordered_removed(self):
        list_ = [[1,2,3,5,9,4,30,5,15]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual([[1,2,3,5,9,4,30,15]], set_)

    def test_removeDuplicates_multDupUnordered_allRemoved(self):
        list_ = [[1,2,5,3,1,70,25,-1,7,-1]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual([[1,2,5,3,70,25,-1,7]], set_)

    def test_removeDuplicates_oneDupOrderedMultDim_removed(self):
        list_ = [[1,1,2],[2,2,3]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual([[1,2],[2,3]], set_)

    def test_removeDuplicates_multDupOrderedMultDim_allRemoved(self):
        list_ = [[1,1,2,3,3],[2,2,3,4,4,5]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual([[1,2,3],[2,3,4,5]], set_)

    def test_removeDuplicates_multDupUnorderedMultDim_allRemoved(self):
        list_ = [[1,2,5,2,7,3],[-10,5,3,20,-10,-7]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual([[1,2,5,7,3],[-10,5,3,20,-7]], set_)

    def test_removeDuplicates_multDupUnorderedMultDim2_allRemoved(self):
        list_ = [[1,2,5,2,7,3],[-10,5,3,20,-10,-7],[1,2]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual([[1,2,5,7,3],[-10,5,3,20,-7],[1,2]], set_)
    
    def test_removeDuplicates_multDupUnorderedTripleDim_noDupRemoved(self):
        list_ = [[[1,2,5,2,7,3],[-10,5,3,20,-10,-7],[1,2]]]
        set_ = self.hypergraph.remove_duplicates(list_)
        self.assertEqual(list_, set_)

if __name__ == '__main__':
    unittest.main()