Neuhauser Krichdorf: new test cases.

This commit is contained in:
Gerhard Hoffmann 2024-02-19 12:01:36 +01:00
parent 696ce644ab
commit 3ff9883647

View File

@ -118,10 +118,10 @@ int main() {
QDateTime s(QDate(2023, 11, 30), QTime()); QDateTime s(QDate(2023, 11, 30), QTime());
// QDateTime s(QDate(2023, 11, 26), QTime()); // QDateTime s(QDate(2023, 11, 26), QTime());
QDateTime end; QDateTime end;
for (int duration = 35; duration <= 35; duration += 5) { for (int duration = 30; duration <= 90; duration += 5) {
// for (int duration = 30; duration <= maxParkingTime; duration += 5) { // for (int duration = 30; duration <= maxParkingTime; duration += 5) {
qCritical() << ""; qCritical() << "";
for (int offset = 1046; offset <= 1046; ++offset) { for (int offset = 420; offset <= 1080; ++offset) {
//for (int offset = 420; offset <= 1080; ++offset) { //for (int offset = 420; offset <= 1080; ++offset) {
//if (offset > 720 && offset < 840) { //if (offset > 720 && offset < 840) {
// continue; // continue;
@ -132,7 +132,7 @@ int main() {
double cost = Calculator::GetInstance().GetCostFromDuration(&cfg, 1, start, end, duration, nextDay, prePaid); double cost = Calculator::GetInstance().GetCostFromDuration(&cfg, 1, start, end, duration, nextDay, prePaid);
#if COST_FROM_DURATION==1 //#if COST_FROM_DURATION==0
double cost_soll = 30 + ((duration-30)/5 * 10); double cost_soll = 30 + ((duration-30)/5 * 10);
uint32_t duration_ist = start.secsTo(end) / 60; uint32_t duration_ist = start.secsTo(end) / 60;
@ -151,9 +151,9 @@ int main() {
qCritical() << " cost (ist) :" << cost; qCritical() << " cost (ist) :" << cost;
if (cost_soll != cost) { if (cost_soll != cost) {
qCritical() << "ERROR" << __func__ << ":" << __LINE__ //qCritical() << "ERROR" << __func__ << ":" << __LINE__
<< "cost_soll" << cost_soll << "cost_ist" << cost; // << "cost_soll" << cost_soll << "cost_ist" << cost;
break; //break;
} }
if (duration != duration_ist) { if (duration != duration_ist) {
//qCritical() << "ERROR" << __func__ << ":" << __LINE__ //qCritical() << "ERROR" << __func__ << ":" << __LINE__
@ -161,15 +161,28 @@ int main() {
//break; //break;
} }
#else //#else
start = s.addSecs(offset * 60);
std::string duration = Calculator::GetInstance().GetDurationFromCost(&cfg, 1, std::string duration = Calculator::GetInstance().GetDurationFromCost(&cfg, 1,
start.toString(Qt::ISODate).toStdString().c_str(), start.toString(Qt::ISODate).toStdString().c_str(),
cost, false, true); cost, false, true);
if (end.toString(Qt::ISODate) != QString(duration.c_str())) {
//qCritical() << "ERROR" << end.toString(Qt::ISODate)
// << QString(duration.c_str());
//break;
}
qCritical() << "start" << start.toString(Qt::ISODate) qCritical() << "start" << start.toString(Qt::ISODate)
<< "cost" << cost << "cost" << cost
<< "until" << duration.c_str() << start.secsTo(QDateTime::fromString(duration.c_str(), Qt::ISODate)) / 60; << "until" << duration.c_str()
<< "end" << end.toString(Qt::ISODate)
<< ":" << start.secsTo(QDateTime::fromString(duration.c_str(), Qt::ISODate)) / 60
<< (end.toString(Qt::ISODate) == QString(duration.c_str()));
#endif // COST_FROM_DURATION //#endif // COST_FROM_DURATION
} }
} }