from dqc_wrapper import checker
import os
import configparser

def main(n):
    this_dir = os.path.dirname(__file__)
    conf_file = os.path.join(this_dir, f"../conf/conf_test05_{n}.ini")
    checker.main([conf_file])
    config_input = configparser.RawConfigParser()
    config_input.read(conf_file)
    config_output = configparser.RawConfigParser()
    config_output.read(os.path.join(config_input["general"]["res_dir"],
                                    f"conf_test05_{n}.ini"))
    return config_output["temporal_consistency_result"]["res"]

def test_nc():
    assert main(4) == "ok"

def test_grib():
    assert main(3) == "ok"

def test_fail():
    assert main(5) == "err"
