Exemplo n.º 1
0
def test_create_files_auto():
    f = Function("f").takes(Int(), "p").returns(Int()).from_file("fg.hxx")
    g = Function("g").takes(Int(), "p").returns(Int()).from_file("fg.hxx")
    h = Function("h").takes(Int(), "p").returns(Int()).from_file("h.hxx")

    c = Qit()
    with pytest.raises(MissingFiles):
        c.run(Range(10).iterate().map(f).map(g).map(h).map(f))

    assert not path.isfile(get_filename_in_build_dir("fg.hxx"))
    assert not path.isfile(get_filename_in_build_dir("h.hxx"))

    c = Qit(create_files=True)
    with pytest.raises(MissingFiles):
        c.run(Range(10).iterate().map(f).map(g).map(h).map(f))

    assert path.isfile(get_filename_in_build_dir("fg.hxx"))
    assert path.isfile(get_filename_in_build_dir("h.hxx"))
Exemplo n.º 2
0
def test_create_files_direct_call():
    c = Qit()
    p = Range(1) * Range(1)
    f = Function("f").takes(p.type, "p").returns(Int()).from_file("myfile.hxx")
    c.create_files(f)
    assert path.isfile(get_filename_in_build_dir("myfile.hxx"))