Beispiel #1
0
    # Need to set an example program for simpl.
    example_sets['simpl'].partial_program = """
fun n ->
i = 1;
r = 1;
while(?) {
?;
}
return r;
"""
    example_sets['simpl'].empty_partial_program = """
fun n ->
?;
return r;
"""
    example_sets['simpl'].int_comps = "1"
    example_sets['simpl'].int_var_comps = 'n,r,i'
    example_sets['simpl'].array_var_comps = 'none'

    base_case = gen_utils.L2Example()
    base_case.add_int_input(2)
    base_case.int_output(1)

    other_base_case = gen_utils.L2Example()
    other_base_case.add_int_input(1)
    other_base_case.int_output(1)
    example_sets['L2'].base_cases = [base_case, other_base_case]

    # Write them out to files.
    gen_utils.write_sets(example_sets)
Beispiel #2
0
    # Set up any important sub-fields in any of the tests.
    # Need to set an example program for simpl.
    example_sets['simpl'].partial_program = """
fun arr, n, m, val, arrout ->
r=0;
p=0;
while(?) {
?;
}
return arrout;
"""
    example_sets['simpl'].empty_partial_program = """
fun arr, n, m, val, arrout ->
?;
return arrout;
"""
    example_sets['simpl'].int_comps = "0,1"
    example_sets['simpl'].int_var_comps = 'r, p, m, n, val'
    example_sets['simpl'].array_var_comps = 'arr, arrout'

    base_case = gen_utils.L2Example()
    base_case.add_array_input([], nolen=True)
    base_case.add_int_input(0)
    base_case.add_int_input(0)
    base_case.add_int_input(2)
    base_case.array_output([], nolen=True)
    example_sets['L2'].base_cases = [base_case]

    # Write them out to files.
    gen_utils.write_sets(example_sets)
Beispiel #3
0
p3 = 0;
while(?) {
?;
}
return outarr;
"""
    example_sets['simpl'].empty_partial_program = """
fun arr, len, arroth, lenoth, outarr, outlen ->
?;
return outarr;
"""
    example_sets['simpl'].int_comps = "0,1"
    example_sets['simpl'].int_var_comps = 'len, lenoth, outlen, p1, p2, p3'
    example_sets['simpl'].array_var_comps = 'arr, arroth, outarr'

    base_case = gen_utils.L2Example()
    base_case.add_array_input([])
    base_case.add_array_input([1])
    base_case.array_output([1])
    base_case2 = gen_utils.L2Example()
    base_case2.add_array_input([1])
    base_case2.add_array_input([])
    base_case2.array_output([1])
    base_case3 = gen_utils.L2Example()
    base_case3.add_array_input([])
    base_case3.add_array_input([])
    base_case3.array_output([])
    example_sets['L2'].base_cases = [base_case, base_case2, base_case3]

    # Write them out to files.
    gen_utils.write_sets(example_sets)