Example #1
0
def test_vector_constructor():
    ctx = Qit()
    s = Struct(Int(), Int())
    v = Vector(s)
    x = Variable(s, "x")
    result = ctx.run(v.value([x, s.value((7, 2)), (1, 2)]),
            args={x: (11,12)})
    assert result == [ (11, 12), (7, 2), (1, 2) ]
Example #2
0
# solution = t_input.value(( # triangle t0 -> t0 -> t1 -> t1 -> t2 -> t2 -> t0 -> ...
    # {0: 2, 1: 0, 2: 2},
    # {
        # (0, 0): 2,
        # (0, 1): 1,
        # (0, 2): 0,
        # (1, 0): 0,
        # (1, 1): 2,
        # (1, 2): 1,
        # (2, 0): 1,
        # (2, 1): 0,
        # (2, 2): 2

    # },
    # {
        # (0, 0): 2,
        # (0, 1): 1,
        # (0, 2): 0,
        # (1, 0): 0,
        # (1, 1): 2,
        # (1, 2): 1,
        # (2, 0): 1,
        # (2, 1): 0,
        # (2, 2): 2
    # }))
# res = ctx.run(t_input.values(solution).iterate().map(f_map_variables))

empty_value = t_result.value((({}, {}, {}), []))
res = ctx.run(init_values.iterate().map(f_process_input).filter(f_eq_statespaces).first(empty_value))
print ("Result: ", res)
Example #3
0
def test_struct_empty():
    ctx = Qit()
    s1 = Struct()
    ctx.run(s1.value(()))