From 9ca7018fc1d55c63cfe241aa23a2bfc2b823f96e Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Fri, 27 Sep 2024 13:42:04 +0200 Subject: [PATCH] tests for bad neuenahr --- main/main.cpp | 33 ++++++++++++++++++++++++++------- main/main.pro | 3 ++- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index 25e0944..f69bb1f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -755,7 +755,7 @@ int main() { int pop_max_price; int pop_daily_card_price; - int zone = 3; + int zone = 1; if (zone == 1) { input.open("/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff01.json"); @@ -844,7 +844,7 @@ int main() { CalcState calcState; QDateTime s(QDateTime::currentDateTime()); - s.setTime(QTime(12, 0, 0)); + // s.setTime(QTime(12, 0, 0)); //calcState = compute_duration_for_parking_ticket(&cfg, s, // (double)1200, end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW)); @@ -852,9 +852,26 @@ int main() { //qCritical() << calcState.toString(); calcState = compute_duration_for_parking_ticket(&cfg, s, - (double)50, end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_BUS)); + (double)9000, end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_BUS)); qCritical() << end.toString(Qt::ISODate); qCritical() << calcState.toString(); + + struct price_t costs; + + CalcState cs; + + for (int i = 0, j=timeSteps.size() ; i < timeSteps.size(); --j, ++i) { + QDateTime end = start.addSecs(timeSteps.at(i)*60); + + qCritical() << "XXXXX end" << end.toString(Qt::ISODate); + + cs = compute_price_for_parking_ticket(&cfg, s, timeSteps.at(i), end, &costs, + PermitType(PERMIT_TYPE::SHORT_TERM_PARKING)); + if (cs.getStatus() != CalcState::State::SUCCESS) { + qCritical() << "ERROR STATUS" << costs.netto; + exit(-1); + } + } } if (zone == 2) { @@ -1391,7 +1408,8 @@ int main() { case 2: { qCritical() << " ZONE 2: KURZZEIT 1"; // kuzzeit-1-tarif - input.open("/opt/ptu5/opt/customer_249/etc/psa_tariff/tariff02.json"); + //input.open("/opt/ptu5/opt/customer_249/etc/psa_tariff/tariff02.json"); + input.open("/opt/ptu5/opt/customer_249/etc/psa_tariff/tariff05.json"); //pop_max_time = 5*60; } break; case 3: { @@ -1583,7 +1601,8 @@ int main() { break; case 1: //start = QDateTime(QDate(2024, 10, 3), QTime(17, 0, 0)); // sunday - start = QDateTime(QDate(2024, 9, 8), QTime(16, 2, 0)); // sunday + //start = QDateTime(QDate(2025, 4, 20), QTime(18, 0, 0)); // sunday + start = QDateTime(QDate(2024, 9, 27), QTime(17, 0, 0)); // friday fail = false; break; case 2: @@ -1615,8 +1634,8 @@ int main() { // << "START" << start.toString(Qt::ISODate) // << "