"""This test verifies that the cache directive generates the right files.

There should be a total of four cached files. One for the rules a (cached via
cli/ api parameter) and c (cached via directive) each.
For rule b there should be two files, one for each extention generated by the
multiext helper.
"""
shell.executable("bash")


rule all:
    input:
        "test3.x.out",
        "test3.y.out"


rule a:
    output:
        "test.out"
    shell:
        "echo test > {output}"


rule b:
    input:
        "test.out"
    output:
        multiext("test2", ".out", ".out2")
    shell:
        "echo test2 > {output[0]}; echo test22 > {output[1]}"


rule c:
    input:
        "test2.out",
        "test.out"
    output:
        "test3.{w}.out"
    params:
        a=1.5
    cache: True
    shell:
        "echo test3 {params.a} > {output}"


rule invalid_multi:
    output:
        "invalid1.txt",
        "invalid2.txt"
    shell:
        "touch {output}"
