From 04e1fe40ba6ddda3601bfb6c7937e22fa8d02e46 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 12 Aug 2024 09:24:48 +0200 Subject: [PATCH] Added test cases for Fuchs/Schnals --- main/main.cpp | 54 ++++++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index 6539b4d..f699960 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -49,9 +49,9 @@ extern "C" char* strptime(const char* s, #define NEUHAUSER_STOCKERAU (0) #define KLEIPEDA_LITAUEN (0) #define SEXTEN (0) -#define SCHNALS_LEITER_KIRCHL (0) +#define SCHNALS_LEITER_KIRCHL (1) #define SCHNALS_STAUMAUER (SCHNALS_LEITER_KIRCHL) -#define VALSER_ALM (1) +#define VALSER_ALM (0) #if NEUHAUSER_KIRCHDORF==1 static bool test_neuhauser_kirchdorf(int step, double cost) { @@ -575,8 +575,8 @@ int main() { int pop_max_price; int pop_daily_card_price; - //input.open("/home/linux/customer_505/etc/psa_tariff/tariff01.json"); - input.open("/opt/ptu5/opt/customer_505/etc/psa_tariff/tariff01.json"); + input.open("/home/linux/customer_505/etc/psa_tariff/tariff01.json"); + //input.open("/opt/ptu5/opt/customer_505/etc/psa_tariff/tariff01.json"); std::stringstream sstr; while(input >> sstr.rdbuf()); @@ -588,10 +588,13 @@ int main() { cout << endl; if (isParsed) { - pop_min_time = get_minimal_parkingtime(&cfg); - pop_max_time = get_maximal_parkingtime(&cfg); - pop_min_price = get_minimal_parkingprice(&cfg); - pop_max_price = get_maximal_parkingprice(&cfg); + //PermitType permitType(PERMIT_TYPE::SHORT_TERM_PARKING); + PermitType permitType(PERMIT_TYPE::DAY_TICKET_PKW); + + pop_min_time = get_minimal_parkingtime(&cfg, permitType); + pop_max_time = get_maximal_parkingtime(&cfg, permitType); + pop_min_price = get_minimal_parkingprice(&cfg, permitType); + pop_max_price = get_maximal_parkingprice(&cfg, permitType); pop_daily_card_price = cfg.getPaymentOptions().pop_daily_card_price; qCritical() << " pop_min_time: " << pop_min_time; @@ -649,10 +652,10 @@ int main() { } //for (int minutes = 0; minutes < 1440; ++minutes) { - for (int minutes = 1020; minutes <= 1020; minutes += 1) { + for (int minutes = 480; minutes <= 480; minutes += 1) { QDateTime start = s.addSecs(minutes * 60); - qCritical() << "start" << start.toString(Qt::ISODate); + // qCritical() << "start" << start.toString(Qt::ISODate); QDateTime effectiveStart = start; @@ -669,8 +672,7 @@ int main() { } #if 0 - PermitType permitType(PERMIT_TYPE::SHORT_TERM_PARKING); - for (int i = 200; i <= 200; i += 10) { + for (int i = 700; i <= 1400; i += 700) { cost = i; if ((cs = compute_duration_for_parking_ticket(&cfg, start, cost, end, permitType))) { // return value @@ -682,38 +684,20 @@ int main() { // qCritical() << cs.toString(); } - qCritical() << "start" << start.toString(Qt::ISODate) << "< cost" << cost - << "> end" << end.toString(Qt::ISODate); + //qCritical() << "start" << start.toString(Qt::ISODate) << "< cost" << cost + // << "> end" << end.toString(Qt::ISODate); } #else - for (int i = 700; i <= 1400; i += 700) { - //for (int i = 2100; i <= 2100; i += 10) { - cost = i; - - if ((cs = compute_duration_for_parking_ticket(&cfg, start, cost, end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW)))) { // return value - } - - if (!cs) { - qCritical() << "ERROR CalcState" << cs.toString() << endl; - } else { -// qCritical() << cs.toString(); - } - - qCritical() << "start" << start.toString(Qt::ISODate) << "< cost" << cost - << "> end" << end.toString(Qt::ISODate); - } -#endif -#if 0 start = QDateTime::currentDateTime(); - start.setTime(QTime(9, 57, 0)); + //start.setTime(QTime(9, 57, 0)); - for (int i = 66; i <= 66; i += 6) { + for (int netto_parking_time = 60; netto_parking_time <= 60; netto_parking_time += 60) { QDateTime end; struct price_t price; - cs = compute_price_for_parking_ticket(&cfg, start, i, end, &price); + cs = compute_price_for_parking_ticket(&cfg, start, netto_parking_time, end, &price, permitType, true); qCritical() << "start" << start.toString(Qt::ISODate) << "end" << end.toString(Qt::ISODate) << "price" << price.netto;