# imports

import random

from topupheat.pipes.single import StandardisedPipeDatabase
from topupheat.common.fluids import FluidDatabase  # , Fluid

from examples_signal import examples as examples_signal

# ******************************************************************************
# ******************************************************************************

# test with: !python -m pytest -s --cov --cov-report term-missing


def test_suite():

    test_examples_signal = True
    # test_examples_signal = False

    # test_examples_converter = True
    # test_examples_dynsys = True
    # test_examples_esipp_network = True
    # test_examples_esipp_problem = True
    # test_examples_esipp = True
    # test_examples_gis = True
    # test_examples_signal = True

    # **************************************************************************

    solver = "scip"
    # scip_exec_path = '/usr/bin/scip'
    # solver_options = {'executable': scip_exec_path}
    solver_options = {}

    # solver = 'cplex'
    # # cplex_exec_path = '/home/pmlpm/Software/CPLEX/cplex/bin/x86-64_linux/cplex'
    # cplex_exec_path = '/home/pmlpm/CPLEX/cplex/bin/x86-64_linux/cplex'
    # #solver_options = {}
    # solver_options = {'executable':cplex_exec_path}

    list_solvers = [
        "fake_solver",
        "cbc",
        "glpk",
        "scip",
        #'cplex'
    ]

    list_solver_options = [
        None,  # fake
        None,  # cbc
        {"tee": False},  # glpk
        None,  # scip
        # cplex
        # {'executable': cplex_exec_path},
    ]

    # **************************************************************************

    seed_number = random.randint(1, int(1e5))

    # seed_number = 13501

    print("Seed number: " + str(seed_number))

    # **************************************************************************

    # load pipe data

    singlepipedata_files = [
        "tests/data/isoplus_singlepipes_s1.csv",
    ]

    singlepipedb = StandardisedPipeDatabase(source=singlepipedata_files)

    # twin pipe data files

    twinpipedata_files = [
        "tests/data/isoplus_twinpipes_s1.csv",
    ]

    twinpipedb = StandardisedPipeDatabase(source=twinpipedata_files)

    # **************************************************************************

    # load fluid data

    # get water properties' database

    waterdata_file = "tests/data/incropera2006_saturated_water.csv"

    water_db = FluidDatabase(fluid="fluid", phase="l", source=waterdata_file)

    # # get oil properties' database

    # oildata_file = '/some_folder/incropera2006_engine_oil.csv'

    # oil_db = FluidDatabase(fluid='oil',
    #                        phase='l',
    #                        source=oildata_file)

    # # get air properties' database

    # airdata_file = '/some_folder/incropera2006_air_1atm.csv'

    # air_db = FluidDatabase(fluid='air',
    #                        phase='g',
    #                        source=airdata_file)

    # load osm/osmnx data
    
    # **************************************************************************

    # signal

    if test_examples_signal:
        print("'signal': testing about to start...")

        examples_signal()

        print("'signal': testing: testing complete.")

    # **************************************************************************
    # **************************************************************************


# ******************************************************************************
# ******************************************************************************