test cases for fuchs-mue=hlbach

This commit is contained in:
Gerhard Hoffmann 2024-08-15 21:45:53 +02:00
parent 84dbfc7234
commit 328f7cb712

View File

@ -741,7 +741,8 @@ int main() {
input.open("/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff02.json");
}
if (zone == 3) {
input.open("/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff03.json");
//input.open("/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff03.json");
input.open("/home/linux/customer_502/etc/psa_tariff/tariff03.json");
}
std::stringstream sstr;
@ -900,7 +901,7 @@ int main() {
int Down = 0;
int Up = 1;
QDateTime const start = QDateTime::currentDateTime();
QDateTime start = QDateTime::currentDateTime();
int paymentOptionIndex = cfg.getPaymentOptionIndex(PERMIT_TYPE::SHORT_TERM_PARKING_PKW);
if (paymentOptionIndex != 0) {
@ -913,17 +914,57 @@ int main() {
//QSet<uint32_t> const prices2{500, 1600, 2400, 3200, 4000, 4800, 5600};
QDateTime end;
CalcState calcState;
QDateTime s(QDateTime::currentDateTime());
s.setTime(QTime(12, 0, 0));
s.setTime(QTime(18, 0, 0));
int minimal_parking_price = get_minimal_parkingprice(&cfg,
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW),
paymentOptionIndex, s);
pop_min_time = get_minimal_parkingtime(&cfg, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING), paymentOptionIndex);
pop_max_time = get_maximal_parkingtime(&cfg, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING), paymentOptionIndex);
pop_min_price = get_minimal_parkingprice(&cfg, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING), paymentOptionIndex, s);
pop_max_price = get_maximal_parkingprice(&cfg, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING), paymentOptionIndex);
pop_daily_card_price = cfg.getPaymentOptions(paymentOptionIndex).pop_daily_card_price;
int h = pop_min_time / 60;
int m = pop_min_time % 60;
qCritical().noquote() << QString(" pop_min_time %1 (%2h, %3m)").arg(pop_min_time).arg(h).arg(m);
h = pop_max_time / 60;
m = pop_max_time % 60;
qCritical().noquote()
<< QString(" pop_max_time %1 (%2h, %3m)").arg(pop_max_time).arg(h).arg(m);
qCritical() << " pop_min_price " << pop_min_price;
qCritical() << " pop_max_price " << pop_max_price;
qCritical() << "pop_daily_card_price " << pop_daily_card_price;
CalcState calcState;
#if 0
for (int i = 1; i < 11; ++i) {
calcState = compute_duration_for_parking_ticket(&cfg, s,
(double)i*200,
end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW));
qCritical() << "RUN" << i << ": start" << s.toString(Qt::ISODate)
<< ": price" << i*200 << "->" << end.toString(Qt::ISODate) << calcState.toString();
}
#else
struct price_t price;
int netto_parking_time = 1440;
start = s;
qCritical() << "RUN" << 0 << ": start" << s.toString(Qt::ISODate);
calcState = compute_price_for_parking_ticket(&cfg, start, netto_parking_time,
end, &price,
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
qCritical() << "RUN" << 0 << ": start" << start.toString(Qt::ISODate)
<< ": price for netto-time" << netto_parking_time
<< "->" << price.netto << "->" << end.toString(Qt::ISODate) << calcState.toString();
#endif
#if 0
qCritical() << "minimal parking price" << minimal_parking_price;
for (int i = 0; i < 8; ++i) {
calcState = compute_duration_for_parking_ticket(&cfg, s,
@ -932,11 +973,11 @@ int main() {
qCritical() << "RUN" << i << end.toString(Qt::ISODate) << calcState.toString();
}
#else
s.setTime(QTime(15, 0, 0));
// #else
s.setTime(QTime(12, 0, 0));
minimal_parking_price = get_minimal_parkingprice(&cfg,
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW),
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_BUS),
paymentOptionIndex, s);
qCritical() << "minimal parking price" << minimal_parking_price;
@ -944,7 +985,7 @@ int main() {
for (int i = 0; i < 8; ++i) {
calcState = compute_duration_for_parking_ticket(&cfg, s,
(double)minimal_parking_price + i*800,
end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW));
end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_BUS));
qCritical() << "RUN" << i << end.toString(Qt::ISODate) << calcState.toString();
}
#endif