test cases for neuhauser-kirchdorf

This commit is contained in:
Gerhard Hoffmann 2024-02-27 12:23:52 +01:00
parent b741d2e312
commit ac6e45a913

View File

@ -269,11 +269,15 @@ int main() {
QList<int>::const_iterator step;
for (step = steps.cbegin(); step != steps.cend(); ++step) {
qCritical() << QString("*** NEXT STEP: %1 ***").arg(*step);
//for (int offset = 7*60; offset < 18*60; ++offset) {
for (int offset = 690; offset < 691; ++offset) {
for (int offset = 7*60; offset < 18*60; ++offset) {
//for (int offset = 7*60; offset < (18*60)-90; ++offset) {
//for (int offset = (18*60)-90; offset < 18*60; ++offset) {
//for (int offset = 1046; offset < 1047; ++offset) {
QDateTime start = s.addSecs(offset * 60);
QDateTime const firstStart = start;
//if (*step != 35) continue;
if (compute_price_for_parking_ticket(&cfg, start, *step, end, &price)) {
double cost = price.netto;
@ -284,66 +288,132 @@ int main() {
qCritical() << " cost :" << cost;
if (offset < 8*60) { // [7:00 - 8:00[
if (!test_neuhauser_kirchdorf(*step, cost)) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
new_cost += ((*step-30)/5)*10;
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
return -1;
//return -1;
}
} else
if (offset < 9*60) { // [8:00 - 9:00[
if (!test_neuhauser_kirchdorf(*step, cost)) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
new_cost += ((*step-30)/5)*10;
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
return -1;
//return -1;
}
} else
if (offset < 10*60) {
if (!test_neuhauser_kirchdorf(*step, cost)) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
new_cost += ((*step-30)/5)*10;
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
return -1;
//return -1;
}
} else
if (offset < 11*60) {
if (!test_neuhauser_kirchdorf(*step, cost)) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
new_cost += ((*step-30)/5)*10;
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
return -1;
//return -1;
}
} else
if (offset < 12*60) {
if (!test_neuhauser_kirchdorf(*step, cost)) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
new_cost += ((*step-30)/5)*10;
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
return -1;
//return -1;
}
} else
if (offset < 13*60) {
if (!test_neuhauser_kirchdorf(*step, cost)) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
new_cost += ((*step-30)/5)*10;
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
return -1;
//return -1;
}
} else
if (offset < 14*60) {
if (!test_neuhauser_kirchdorf(*step, cost)) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
new_cost += ((*step-30)/5)*10;
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
return -1;
//return -1;
}
} else
if (offset < 15*60) {
if (!test_neuhauser_kirchdorf(*step, cost)) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
new_cost += ((*step-30)/5)*10;
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
return -1;
//return -1;
}
} else
if (offset < 16*60) {
if (!test_neuhauser_kirchdorf(*step, cost)) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
new_cost += ((*step-30)/5)*10;
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
return -1;
//return -1;
}
} else
if (offset < 17*60) {
if (!test_neuhauser_kirchdorf(*step, cost)) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
double const f = ((*step-30)/5)*10;
new_cost += f;
new_cost = std::min(new_cost, f+30);
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
return -1;
//return -1;
}
} else
if (offset < 18*60) {
double new_cost = cost;
if (offset > (18*60)-(*step)) {
double const f = ((*step-30)/5)*10;
new_cost += f;
new_cost = std::min(new_cost, f+30);
qCritical() << __LINE__ << "new_cost" << new_cost << "(cost" << cost << ")";
}
if (!test_neuhauser_kirchdorf(*step, new_cost)) {
qCritical() << "ERROR AT OFFSET" << offset;
// return -1;
}
} else {
qCritical() << "WARN OFFSET TOO HIGH" << offset;
qCritical() << "ERROR OFFSET TOO HIGH" << offset;
return -1;
}
} else {