Skip to content
Snippets Groups Projects
non-reg.exp 993 B

set timeout 10

set ok_files [glob should_work/*.lus]


set id [should_work "Unit tests" "$lus2lic" "-unit"]
wait -i $id

foreach f $ok_files {
    set bf [file rootname $f]
    set bf /tmp/[file tail $bf]
    set id1 [should_work "without any option" "$lus2lic" "-o $bf.lic $f"]
    wait -i $id1
    set id2 [should_work "Generate ec code  " "$lus2lic" "-ec -o $bf.ec $f"]
    wait -i $id2
    if { [emptyfile "$bf.ec"] } {
        set id3 [should_work "Try ec2c on the result" "$ec2c" "-o $bf.c $bf.ec"]
        wait -i $id3
    }
}


# Programs that should fail
proc iter_should_fail { fail_kind } {
    global lus2lic

    set files  [glob should_fail/$fail_kind/*.lus]
    foreach f $files {
        set bf [file rootname $f]
        set bf /tmp/[file tail $bf]
        set id [should_fail "Test bad programs" "$fail_kind" "$lus2lic" "-o $bf.lic $f"]
        wait -i $id
    }
}

iter_should_fail "syntax"
iter_should_fail "type"
iter_should_fail "clock"
iter_should_fail "semantics"