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_test00_{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_test00_{n}.ini"))
    return config_output["file_format_result"]["res"]

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

def test_zip():
    assert main(7) == "ok"

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

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