#include "CivHydrTest.h"
#include "CivHydrFuncInter.h"
#include <iostream>


// 水力测试
void CivConHydrTest::test(char* uri)
{
    int succ = hdyrSimulation(uri);
    std::cout << "测试结果：" << succ << std::endl;
}

// 水质测试
void CivConQuaTest::test(char* uri)
{
    int succ = qualitySimulation(uri);
    std::cout << "测试结果：" << succ << std::endl;
}

// 追踪分析
void CivConTrackTest::test(char* uri)
{
    char result[1024 * 32];

    char sn[32];
    strcpy_s(sn, "JD00000016");

    int succ = trackingSimulation(uri, sn, 5, result);

    std::cout << result << std::endl;
    std::cout << "测试结果：" << succ << std::endl;
}

/**
  获取时段数据
*/
void CivConGetDataTest::test(char* uri)
{
    const char* date = "2020-07-17";
    char* dates = const_cast<char*>(date);

    const char* interval = "4";

    char* intervals = const_cast<char*>(interval);

    bool isSucces = getDataByInterval(uri, dates, intervals);
    std::cout << "测试结果：" << isSucces << std::endl;
};

void CivConGetRptTest::test(char* uri)
{
    std::string condtion = "\"日期\"='2020-07-13' and \"时段\"=1";
    std::string type = "管段";
    char result[1024 * 128];

    char newCondition[256];
    strcpy(newCondition, condtion.c_str());
    char newType[32];
    strcpy(newType, type.c_str());

    bool isSucc = getRptByCondition(uri, newType, newCondition, result);

    std::cout << result << std::endl;
    std::cout << "测试结果：" << isSucc << std::endl;
}

void CivUpstreamTrackingTest::test(char* uri)
{
    // 追踪节点编号
    char sn[32];
    strcpy(sn, "JD00000016");

    char result[1024 * 32];

    bool isSucc = upstreamTracking(uri, sn, result);

    std::cout << result << std::endl;
    std::cout << "测试结果：" << isSucc << std::endl;
}


/**
   下游追踪
*/
void CivDownStreamTrackingTest::test(char* uri)
{
    // 追踪节点编号
    char sn[32];
    strcpy(sn, "JD00000047");

    char result[1024 * 128];

    bool isSucc = downstreamTracking(uri, sn, result);

    std::cout << result << std::endl;
    std::cout << "测试结果：" << isSucc << std::endl;
}


/**
   水源供水范围分析
*/
void CivWaterSupplyScopeTest::test(char* uri)
{
    // 追踪节点编号
    char sn[32];
    strcpy(sn, "JD00000016");

    char result[1024 * 32];

    bool isSucc = waterSupplyScopeAnalysis(uri, sn, result);

    std::cout << result << std::endl;
    std::cout << "测试结果：" << isSucc << std::endl;
}
