Add some tests for Forchach (749)
This commit is contained in:
parent
4b9a4319b3
commit
1f6606f382
@ -39,11 +39,11 @@ extern "C" char* strptime(const char* s,
|
||||
|
||||
#define SZEGED (0)
|
||||
#define SCHOENAU_KOENIGSEE (0)
|
||||
#define NEUHAUSER_KORNEUBURG (0)
|
||||
#define NEUHAUSER_KORNEUBURG (1)
|
||||
#define NEUHAUSER_LINSINGER_MASCHINENBAU (0)
|
||||
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
|
||||
#define NEUHAUSER_BILEXA_GALTUER (0)
|
||||
#define BAD_NEUENAHR_AHRWEILER (1)
|
||||
#define BAD_NEUENAHR_AHRWEILER (0)
|
||||
#define NEUHAUSER_CHRISTOPH_REISEN (0)
|
||||
#define NEUHAUSER_PERNEGG_AN_DER_MUR (0)
|
||||
#define NEUHAUSER_STOCKERAU (0)
|
||||
@ -52,6 +52,7 @@ extern "C" char* strptime(const char* s,
|
||||
#define SCHNALS_LEITER_KIRCHL (0)
|
||||
#define SCHNALS_STAUMAUER (SCHNALS_LEITER_KIRCHL)
|
||||
#define VALSER_ALM (0)
|
||||
#define NEUHAUSER_FORCHACH (0)
|
||||
|
||||
#if NEUHAUSER_KIRCHDORF==1
|
||||
static bool test_neuhauser_kirchdorf(int step, double cost) {
|
||||
@ -1386,6 +1387,29 @@ int main() {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#if NEUHAUSER_FORCHACH==1
|
||||
std::ifstream input;
|
||||
input.open("/opt/ptu5/opt/customer_749/etc/psa_tariff/tariff01.json");
|
||||
|
||||
std::stringstream sstr;
|
||||
while(input >> sstr.rdbuf());
|
||||
std::string json(sstr.str());
|
||||
|
||||
Configuration cfg;
|
||||
|
||||
bool isParsed = cfg.ParseJson(&cfg, json.c_str());
|
||||
cout << endl;
|
||||
|
||||
if (isParsed) {
|
||||
compute_product_price(&cfg, PermitType(PERMIT_TYPE::DAY_TICKET_PKW));
|
||||
compute_product_price(&cfg, PermitType(PERMIT_TYPE::DAY_TICKET_CAMPER));
|
||||
|
||||
QDateTime start = QDateTime::currentDateTime();
|
||||
QDateTime ticketEndTime;
|
||||
compute_duration_for_daily_ticket(&cfg, start, ticketEndTime, PermitType(PERMIT_TYPE::DAY_TICKET));
|
||||
}
|
||||
|
||||
#endif
|
||||
#if BAD_NEUENAHR_AHRWEILER==1
|
||||
std::ifstream input;
|
||||
@ -2780,24 +2804,62 @@ int main() {
|
||||
bool nextDay = false;
|
||||
bool prePaid = true;
|
||||
// zone 1 (lila)
|
||||
QDateTime s(QDate(2023, 11, 30), QTime());
|
||||
QDateTime s(QDate(2024, 10, 8), QTime());
|
||||
QDateTime end;
|
||||
|
||||
static QList<int> const timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg);
|
||||
qCritical() << "TimeSteps" << timeSteps;
|
||||
|
||||
for (int duration = 30; duration <= pop_max_time; duration += 5) {
|
||||
for (int offset = 420; offset < 1140; ++offset) {
|
||||
if (offset > 720 && offset < 840) {
|
||||
continue;
|
||||
}
|
||||
int offset = 600;
|
||||
//for (int offset = 720; offset < 601; ++offset) {
|
||||
//if (offset > 720 && offset < 840) {
|
||||
// continue;
|
||||
//}
|
||||
QDateTime start = s.addSecs(offset * 60);
|
||||
//qCritical() << "start" << start.toString(Qt::ISODate);
|
||||
|
||||
double cost = Calculator::GetInstance().GetCostFromDuration(&cfg, 3, start, end, duration, nextDay, prePaid);
|
||||
CalcState cs;
|
||||
#if 1
|
||||
struct price_t costs;
|
||||
for (int i = 0, j=timeSteps.size() ; i < timeSteps.size(); --j, ++i) {
|
||||
QDateTime end = start.addSecs(timeSteps.at(i)*60);
|
||||
|
||||
// if (i != 2) continue;
|
||||
|
||||
cs = compute_price_for_parking_ticket(&cfg, start, timeSteps.at(i), end, &costs, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
|
||||
int price1 = costs.netto;
|
||||
|
||||
qCritical() << "compute_price_for_parking_ticket()/GetCostFromDuration() TIME: "
|
||||
<< timeSteps.at(i) << "ZZZZZZZZZZZZZ PRICE=" << price1 << "end=" << end.toString(Qt::ISODate);
|
||||
}
|
||||
exit(0);
|
||||
#else
|
||||
|
||||
double cost = 360;
|
||||
qCritical() << "XXXXXXXX START" << start.toString(Qt::ISODate) << "cost" << cost;
|
||||
QDateTime end;
|
||||
|
||||
cs = compute_duration_for_parking_ticket(&cfg, start, cost, end,
|
||||
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
|
||||
qCritical() << __LINE__ << cs.toString()
|
||||
<< "START" << start.toString(Qt::ISODate)
|
||||
<< "<duration" << start.secsTo(end) / 60
|
||||
<< "cost" << cost
|
||||
<< "> end" << end.toString(Qt::ISODate);
|
||||
//}
|
||||
|
||||
exit(0);
|
||||
#endif
|
||||
|
||||
//double cost = Calculator::GetInstance().GetCostFromDuration(&cfg, 3, start, end, duration, nextDay, prePaid);
|
||||
//Q_ASSERT(cost == duration*2.5);
|
||||
//qCritical() << "";
|
||||
qCritical() << "start" << start.toString(Qt::ISODate)
|
||||
<< "end" << end.toString(Qt::ISODate)
|
||||
<< "duration" << duration
|
||||
<< "cost" << cost;
|
||||
|
||||
//qCritical() << "start" << start.toString(Qt::ISODate)
|
||||
// << "end" << end.toString(Qt::ISODate)
|
||||
// << "duration" << duration
|
||||
// << "cost" << cost;
|
||||
#if 0
|
||||
switch(duration) {
|
||||
case 30:
|
||||
if (cost == 60.0) {
|
||||
@ -2961,15 +3023,17 @@ int main() {
|
||||
<< "cost" << cost;
|
||||
exit(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
//std::string duration = Calculator::GetInstance().GetDurationFromCost(&cfg, 3, start.toString(Qt::ISODate).toStdString().c_str(), cost);
|
||||
//Q_ASSERT(cost == duration*2.5);
|
||||
//qCritical() << "start" << start.toString(Qt::ISODate)
|
||||
// << "cost" << cost
|
||||
// << "until" << duration.c_str() << start.secsTo(QDateTime::fromString(duration.c_str(), Qt::ISODate)) / 60;
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
#if 0
|
||||
Configuration::SpecialDaysType specialDays = cfg.SpecialDays;
|
||||
for (Configuration::SpecialDaysType::const_iterator it = specialDays.cbegin();
|
||||
it != specialDays.cend(); ++it) {
|
||||
@ -2990,7 +3054,7 @@ int main() {
|
||||
<< "duration" << duration
|
||||
<< "cost" << cost;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user