示例#1
0
    def test_intervals_splits_complex_vectors_correctly(self):
        ivs1 = Intervals([1,2,2,1])
        ivs2 = Intervals([0,1,2,1,1,2])
        ivs3 = Intervals([0,0,1,3,2,3,4,4,4,2])

        self.assertEquals([[1,2,2],[1]], ivs1.get_intervals())
        self.assertEquals([[0,1,2],[1,1],[2]], ivs2.get_intervals())
        self.assertEquals([[0,0],[1,3],[2],[3,4,4,4],[2]],ivs3.get_intervals())
示例#2
0
    def test_intervals_calculates_correct_differences(self):
        ivs1 = Intervals([0,1,2,1,0])
        ivs2 = Intervals([0,1,2,1,0,1,2])
        ivs3 = Intervals([0,0,1,3,2,3,4,4,4,2])

        self.assertEquals([2,-2], ivs1.get_differences())
        self.assertEquals([2,-2, 2], ivs2.get_differences())
        self.assertEquals([0, 3, -1, 2, -2], ivs3.get_differences())
示例#3
0
    def test_intervals_splits_trivial_vectors_correctly(self):
        ivs1 = Intervals([0,1,2,1,0])
        ivs2 = Intervals([2,1,0,1,2])

        self.assertEquals([[0,1,2], [1,0]], ivs1.get_intervals())
        self.assertEquals([[2,1,0], [1,2]], ivs2.get_intervals())
示例#4
0
    def test_intervals_splits_simple_vectors_correctly(self):
        ivs1 = Intervals([0,1,2,1,0,1,2])
        ivs2 = Intervals([0,-1,-2,0,1,2,0])

        self.assertEquals([[0,1,2], [1,0], [1,2]], ivs1.get_intervals())
        self.assertEquals([[0,-1,-2], [0,1,2], [0]], ivs2.get_intervals())