예제 #1
0
def test_return_bool():
	empty = isl.set("{ : false }")
	univ = isl.set("{ : }")

	b_true = empty.is_empty()
	b_false = univ.is_empty()

	assert(b_true)
	assert(not b_false)
예제 #2
0
def test_return_string():
	context = isl.set("[n] -> { : }")
	build = isl.ast_build.from_context(context)
	pw_aff = isl.pw_aff("[n] -> { [n] }")
	set = isl.set("[n] -> { : n >= 0 }")

	expr = build.expr_from(pw_aff)
	expected_string = "n"
	assert(expected_string == expr.to_C_str())

	expr = build.expr_from(set)
	expected_string = "n >= 0"
	assert(expected_string == expr.to_C_str())
예제 #3
0
def test_constructors():
	zero1 = isl.val("0")
	assert(zero1.is_zero())

	zero2 = isl.val(0)
	assert(zero2.is_zero())

	zero3 = isl.val.zero()
	assert(zero3.is_zero())

	bs = isl.basic_set("{ [1] }")
	result = isl.set("{ [1] }")
	s = isl.set(bs)
	assert(s.is_equal(result))
예제 #4
0
def test_foreach():
	s = isl.set("{ [0]; [1]; [2] }")

	list = []
	def add(bs):
		list.append(bs)
	s.foreach_basic_set(add)

	assert(len(list) == 3)
	assert(list[0].is_subset(s))
	assert(list[1].is_subset(s))
	assert(list[2].is_subset(s))
	assert(not list[0].is_equal(list[1]))
	assert(not list[0].is_equal(list[2]))
	assert(not list[1].is_equal(list[2]))

	def fail(bs):
		raise "fail"

	caught = False
	try:
		s.foreach_basic_set(fail)
	except:
		caught = True
	assert(caught)
예제 #5
0
def test_parameters_obj():
	a = isl.set("{ [0] }")
	b = isl.set("{ [1] }")
	c = isl.set("{ [2] }")
	expected = isl.set("{ [i] : 0 <= i <= 2 }")

	tmp = a.union(b)
	res_lvalue_param = tmp.union(c)
	assert(res_lvalue_param.is_equal(expected))

	res_rvalue_param = a.union(b).union(c)
	assert(res_rvalue_param.is_equal(expected))

	a2 = isl.basic_set("{ [0] }")
	assert(a.is_equal(a2))

	two = isl.val(2)
	half = isl.val("1/2")
	res_only_this_param = two.inv()
	assert(res_only_this_param.eq(half))
예제 #6
0
파일: pet.py 프로젝트: Meinersbur/pet
 def get_context(self):
     return isl.set(ctx=self.ctx, ptr=pet.pet_scop_get_context(self.ptr))
예제 #7
0
 def not_in_A(s):
     return not s.is_subset(isl.set("{ A[x] }"))
예제 #8
0
 def in_A(s):
     return s.is_subset(isl.set("{ A[x] }"))
예제 #9
0
	def not_in_A(s):
		return not s.is_subset(isl.set("{ A[x] }"))
예제 #10
0
	def in_A(s):
		return s.is_subset(isl.set("{ A[x] }"))