def test_if_condition(self):

    def if_cond(switch, size, num):
        if (switch > 0.5):
            return [size, num, num]
        return [size, num]
    spec = merge([uniform(0, 1), uniform(1, 2), uniform(2, 3)], if_cond)
    parsed = ParsedSpec(spec)
    self.assertEqual(parsed.size(), 3)
    self.assertEqual([1, 2], parsed.instantiate([0, 0, 0]))
    self.assertEqual([2, 3], parsed.instantiate([0, 1, 1]))
    self.assertEqual([1, 2, 2], parsed.instantiate([1, 0, 0]))
    self.assertEqual([2, 3, 3], parsed.instantiate([1, 1, 1]))
def test_if_condition(self):

    def if_cond(switch, size, num):
        if (switch > 0.5):
            return [size, num, num]
        return [size, num]
    spec = merge([uniform(0, 1), uniform(1, 2), uniform(2, 3)], if_cond)
    parsed = ParsedSpec(spec)
    self.assertEqual(parsed.size(), 3)
    self.assertEqual([1, 2], parsed.instantiate([0, 0, 0]))
    self.assertEqual([2, 3], parsed.instantiate([0, 1, 1]))
    self.assertEqual([1, 2, 2], parsed.instantiate([1, 0, 0]))
    self.assertEqual([2, 3, 3], parsed.instantiate([1, 1, 1]))