Adapted tests for NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM

This commit is contained in:
Gerhard Hoffmann 2024-02-28 09:26:05 +01:00
parent 493d94aaa1
commit 3ad2c77467

View File

@ -34,13 +34,13 @@ extern "C" char* strptime(const char* s,
#include "calculator_functions.h" #include "calculator_functions.h"
#include "calculate_price.h" #include "calculate_price.h"
#define SZEGED (1) #define SZEGED (0)
#define SCHOENAU_KOENIGSEE (0) #define SCHOENAU_KOENIGSEE (0)
#define NEUHAUSER_KORNEUBURG (0) #define NEUHAUSER_KORNEUBURG (0)
#define NEUHAUSER_LINSINGER_MASCHINENBAU (0) #define NEUHAUSER_LINSINGER_MASCHINENBAU (0)
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0) #define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (1)
#define NEUHAUSER_BILEXA_GALTUER (0) #define NEUHAUSER_BILEXA_GALTUER (0)
#define NEUHAUSER_KIRCHDORF (1) #define NEUHAUSER_KIRCHDORF (0)
#if NEUHAUSER_KIRCHDORF==1 #if NEUHAUSER_KIRCHDORF==1
static bool test_neuhauser_kirchdorf(int step, double cost) { static bool test_neuhauser_kirchdorf(int step, double cost) {
@ -429,13 +429,12 @@ int main() {
QDateTime end2 = QDateTime(); QDateTime end2 = QDateTime();
if (compute_duration_for_parking_ticket(&cfg, start, cost, end2)) { // return value if (compute_duration_for_parking_ticket(&cfg, start, cost, end2)) { // return value
qCritical() << "XXXX start" << start.toString(Qt::ISODate) qCritical() << "start" << start.toString(Qt::ISODate)
<< "offset" << offset << "offset" << offset
<< "cost" << cost << "cost" << cost
<< "end" << end2.toString(Qt::ISODate); << "end" << end2.toString(Qt::ISODate);
if (end != end2) { if (end != end2) {
qCritical() << "YYYY" qCritical() << end.toString(Qt::ISODate)
<< end.toString(Qt::ISODate)
<< end2.toString(Qt::ISODate); << end2.toString(Qt::ISODate);
} }
} }
@ -603,39 +602,28 @@ int main() {
int w = compute_product_price(&cfg, PERMIT_TYPE::DAY_TICKET_TEEN); int w = compute_product_price(&cfg, PERMIT_TYPE::DAY_TICKET_TEEN);
qCritical() << "price teen" << w; qCritical() << "price teen" << w;
return 0;
QDateTime s(QDate(2023, 11, 30), QTime()); QDateTime s(QDate(2023, 11, 30), QTime());
QDateTime end; QDateTime end;
struct price_t price; struct price_t price;
#define ADULT 0 #define ADULT 1
#define TEEN 1 //#define TEEN 1
for (int offset = 480; offset < 1200; ++offset) {
QDateTime start = s.addSecs(offset * 60);
CalcState cs = compute_price_for_daily_ticket(&cfg, start, end,
#if ADULT==1 #if ADULT==1
for (int offset = 480; offset < 1080; ++offset) { PERMIT_TYPE::DAY_TICKET_ADULT,
QDateTime start = s.addSecs(offset * 60); #elif TEEN==1
PERMIT_TYPE::DAY_TICKET_TEEN,
// qCritical() << QString(Calculator::GetInstance().isParkingAllowed(&cfg, start)); #endif
&price);
CalcState cs = compute_price_for_daily_ticket(&cfg, start, end,
PERMIT_TYPE::DAY_TICKET_ADULT, &price);
qCritical() << "start=" << start.toString(Qt::ISODate) qCritical() << "start=" << start.toString(Qt::ISODate)
<< "end" << end.toString(Qt::ISODate) << "price" << price.netto; << "end" << end.toString(Qt::ISODate) << "price" << price.netto;
} }
#endif
#if TEEN==1
for (int offset = 480; offset < 1080; ++offset) {
QDateTime start = s.addSecs(offset * 60);
CalcState cs = compute_price_for_daily_ticket(&cfg, start, end,
PERMIT_TYPE::DAY_TICKET_TEEN, &price);
qCritical() << "start=" << start.toString(Qt::ISODate)
<< "end" << end.toString(Qt::ISODate) << "price" << price.netto;
}
#endif
} }
#undef ADULT
#undef TEEN
#endif #endif
#if NEUHAUSER_LINSINGER_MASCHINENBAU==1 #if NEUHAUSER_LINSINGER_MASCHINENBAU==1