Example #1
0
    def test_sparse_values_even_order(self):
        times = 2
        order = 6

        a_0_val = [1, 1, 2]
        a_t_val = [1, 2, 1, 4, 4, 2, 8, 12, 12, 16, 32, 48, 32, 80, 160, 64,
                   192, 480]

        expect = (a_0_val, a_t_val)

        # Compare result and expected value
        result = constraint.sparse_values(times, order)

        assert(len(expect) == len(result))
        for i in range(0, len(expect)):
            np.testing.assert_array_equal(result[i], expect[i])
Example #2
0
 def test_sparse_values_zero(self):
     np.testing.assert_equal(constraint.sparse_values(self.zero_times,
                                                      self.zero_order),
                             ([], []))
Example #3
0
 def test_sparse_values_negative(self):
     np.testing.assert_equal(constraint.sparse_values(self.negative_times,
                                                      self.negative_order),
                             ([], []))