'Test the size_metrics method.'

def test_size_metrics(self):

    p1 = Parameter()
    p2 = Parameter(3, sign='negative')
    p3 = Parameter(4, 4, sign='positive')
    c1 = numpy.random.randn(2, 1)
    c2 = numpy.random.randn(1, 2)
    constants = [2, c2.dot(c1)]
    p = Problem(Minimize(p1), [((self.a + p1) <= p2), (self.b <= ((p3 + p3) + constants[0])), (self.c == constants[1])])
    n_variables = p.size_metrics.num_scalar_variables
    ref = ((numpy.prod(self.a.size) + numpy.prod(self.b.size)) + numpy.prod(self.c.size))
    if PY2:
        self.assertEqual(n_variables, ref)
    else:
        self.assertEqual(n_variables, ref)
    n_data = p.size_metrics.num_scalar_data
    ref = (((numpy.prod(p1.size) + numpy.prod(p2.size)) + numpy.prod(p3.size)) + len(constants))
    self.assertEqual(n_data, ref)
    n_eq_constr = p.size_metrics.num_scalar_eq_constr
    ref = c2.dot(c1).size
    self.assertEqual(n_eq_constr, ref)
    n_leq_constr = p.size_metrics.num_scalar_leq_constr
    ref = (numpy.prod(p3.size) + numpy.prod(p2.size))
    self.assertEqual(n_leq_constr, ref)
    max_data_dim = p.size_metrics.max_data_dimension
    ref = max(p3.size)
    self.assertEqual(max_data_dim, ref)
