test cases for neuhauser-kirchdorf
This commit is contained in:
parent
b741d2e312
commit
ac6e45a913
116
main/main.cpp
116
main/main.cpp
@ -269,11 +269,15 @@ int main() {
|
|||||||
QList<int>::const_iterator step;
|
QList<int>::const_iterator step;
|
||||||
for (step = steps.cbegin(); step != steps.cend(); ++step) {
|
for (step = steps.cbegin(); step != steps.cend(); ++step) {
|
||||||
qCritical() << QString("*** NEXT STEP: %1 ***").arg(*step);
|
qCritical() << QString("*** NEXT STEP: %1 ***").arg(*step);
|
||||||
//for (int offset = 7*60; offset < 18*60; ++offset) {
|
for (int offset = 7*60; offset < 18*60; ++offset) {
|
||||||
for (int offset = 690; offset < 691; ++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 start = s.addSecs(offset * 60);
|
||||||
QDateTime const firstStart = start;
|
QDateTime const firstStart = start;
|
||||||
|
|
||||||
|
//if (*step != 35) continue;
|
||||||
|
|
||||||
if (compute_price_for_parking_ticket(&cfg, start, *step, end, &price)) {
|
if (compute_price_for_parking_ticket(&cfg, start, *step, end, &price)) {
|
||||||
double cost = price.netto;
|
double cost = price.netto;
|
||||||
|
|
||||||
@ -284,66 +288,132 @@ int main() {
|
|||||||
qCritical() << " cost :" << cost;
|
qCritical() << " cost :" << cost;
|
||||||
|
|
||||||
if (offset < 8*60) { // [7:00 - 8:00[
|
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;
|
qCritical() << "ERROR AT OFFSET" << offset;
|
||||||
return -1;
|
//return -1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (offset < 9*60) { // [8:00 - 9:00[
|
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;
|
qCritical() << "ERROR AT OFFSET" << offset;
|
||||||
return -1;
|
//return -1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (offset < 10*60) {
|
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;
|
qCritical() << "ERROR AT OFFSET" << offset;
|
||||||
return -1;
|
//return -1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (offset < 11*60) {
|
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;
|
qCritical() << "ERROR AT OFFSET" << offset;
|
||||||
return -1;
|
//return -1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (offset < 12*60) {
|
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;
|
qCritical() << "ERROR AT OFFSET" << offset;
|
||||||
return -1;
|
//return -1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (offset < 13*60) {
|
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;
|
qCritical() << "ERROR AT OFFSET" << offset;
|
||||||
return -1;
|
//return -1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (offset < 14*60) {
|
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;
|
qCritical() << "ERROR AT OFFSET" << offset;
|
||||||
return -1;
|
//return -1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (offset < 15*60) {
|
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;
|
qCritical() << "ERROR AT OFFSET" << offset;
|
||||||
return -1;
|
//return -1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (offset < 16*60) {
|
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;
|
qCritical() << "ERROR AT OFFSET" << offset;
|
||||||
return -1;
|
//return -1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (offset < 17*60) {
|
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;
|
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 {
|
} else {
|
||||||
qCritical() << "WARN OFFSET TOO HIGH" << offset;
|
qCritical() << "ERROR OFFSET TOO HIGH" << offset;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user