add tests for bad-neuenahr
This commit is contained in:
parent
eca285cc25
commit
2b9657787d
133
main/main.cpp
133
main/main.cpp
@ -43,7 +43,7 @@ extern "C" char* strptime(const char* s,
|
||||
#define NEUHAUSER_LINSINGER_MASCHINENBAU (0)
|
||||
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
|
||||
#define NEUHAUSER_BILEXA_GALTUER (0)
|
||||
#define BAD_NEUENAHR_AHRWEILER (0)
|
||||
#define BAD_NEUENAHR_AHRWEILER (1)
|
||||
#define NEUHAUSER_CHRISTOPH_REISEN (0)
|
||||
#define NEUHAUSER_PERNEGG_AN_DER_MUR (0)
|
||||
#define NEUHAUSER_STOCKERAU (0)
|
||||
@ -51,7 +51,7 @@ extern "C" char* strptime(const char* s,
|
||||
#define SEXTEN (0)
|
||||
#define SCHNALS_LEITER_KIRCHL (0)
|
||||
#define SCHNALS_STAUMAUER (SCHNALS_LEITER_KIRCHL)
|
||||
#define VALSER_ALM (1)
|
||||
#define VALSER_ALM (0)
|
||||
|
||||
#if NEUHAUSER_KIRCHDORF==1
|
||||
static bool test_neuhauser_kirchdorf(int step, double cost) {
|
||||
@ -339,20 +339,20 @@ int main() {
|
||||
cout << endl;
|
||||
|
||||
if (isParsed) {
|
||||
pop_min_time = get_minimal_parkingtime(&cfg);
|
||||
pop_max_time = get_maximal_parkingtime(&cfg);
|
||||
pop_min_price = get_minimal_parkingprice(&cfg);
|
||||
pop_max_price = get_maximal_parkingprice(&cfg);
|
||||
pop_daily_card_price = cfg.getPaymentOptions().pop_daily_card_price;
|
||||
//pop_min_time = get_minimal_parkingtime(&cfg);
|
||||
//pop_max_time = get_maximal_parkingtime(&cfg);
|
||||
//pop_min_price = get_minimal_parkingprice(&cfg);
|
||||
//pop_max_price = get_maximal_parkingprice(&cfg);
|
||||
//pop_daily_card_price = cfg.getPaymentOptions().pop_daily_card_price;
|
||||
|
||||
qCritical() << " pop_min_time: " << pop_min_time;
|
||||
qCritical() << " pop_max_time: " << pop_max_time;
|
||||
qCritical() << " pop_min_price: " << pop_min_price;
|
||||
qCritical() << " pop_max_price: " << pop_max_price;
|
||||
//qCritical() << " pop_min_time: " << pop_min_time;
|
||||
//qCritical() << " pop_max_time: " << pop_max_time;
|
||||
//qCritical() << " pop_min_price: " << pop_min_price;
|
||||
//qCritical() << " pop_max_price: " << pop_max_price;
|
||||
|
||||
|
||||
QList<int> timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg);
|
||||
qCritical() << "TimeSteps" << timeSteps;
|
||||
//QList<int> timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg);
|
||||
//qCritical() << "TimeSteps" << timeSteps;
|
||||
|
||||
// return 0;
|
||||
|
||||
@ -363,8 +363,7 @@ int main() {
|
||||
|
||||
// for (int day = Qt::Monday; day <= Qt::Sunday; ++day) {
|
||||
for (int day = Qt::Monday; day <= Qt::Monday; ++day) {
|
||||
QDateTime s(QDate(2024, 7, 29 + day), QTime()); // 20: (whit) monday,..., 26: sunday
|
||||
QDateTime end;
|
||||
QDateTime s(QDate(2024, 8, 19 + day), QTime()); // 20: (whit) monday,..., 26: sunday
|
||||
|
||||
switch (day) {
|
||||
case (int)Qt::Monday:
|
||||
@ -390,6 +389,30 @@ int main() {
|
||||
break;
|
||||
}
|
||||
|
||||
QDateTime start(s);
|
||||
start.setTime(QTime(21, 30, 0));
|
||||
|
||||
QDateTime end;
|
||||
int netto_parking_time = 14 * 60;
|
||||
struct price_t costs;
|
||||
PermitType pt(PERMIT_TYPE::SHORT_TERM_PARKING);
|
||||
|
||||
double cost = 150;
|
||||
|
||||
//cs = compute_price_for_parking_ticket(&cfg, start, netto_parking_time,
|
||||
// end, &costs, pt);
|
||||
|
||||
|
||||
|
||||
//qCritical() << "start" << start.toString(Qt::ISODate) << "< cost" << costs.netto
|
||||
// << "> end" << end.toString(Qt::ISODate);
|
||||
|
||||
cs = compute_duration_for_parking_ticket(&cfg, start, cost, end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
|
||||
qCritical() << "start" << start.toString(Qt::ISODate) << "< cost" << cost
|
||||
<< "> end" << end.toString(Qt::ISODate);
|
||||
//}
|
||||
|
||||
exit(0);
|
||||
|
||||
/*
|
||||
CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
||||
@ -1357,7 +1380,7 @@ int main() {
|
||||
int pop_carry_over;
|
||||
int pop_carry_over_time_range_id;
|
||||
|
||||
for (int zone=1; zone < 2; ++zone) {
|
||||
for (int zone=2; zone < 3; ++zone) {
|
||||
//for (int t=6; t < 7; t+=20) {
|
||||
switch (zone) {
|
||||
case 1: {
|
||||
@ -1366,6 +1389,7 @@ int main() {
|
||||
//pop_max_time = 6*60;
|
||||
} break;
|
||||
case 2: {
|
||||
qCritical() << " ZONE 2: KURZZEIT 1";
|
||||
// kuzzeit-1-tarif
|
||||
input.open("/opt/ptu5/opt/customer_249/etc/psa_tariff/tariff02.json");
|
||||
//pop_max_time = 5*60;
|
||||
@ -1408,6 +1432,11 @@ int main() {
|
||||
cout << endl;
|
||||
|
||||
if (isParsed) {
|
||||
|
||||
qCritical() << "Parsed";
|
||||
|
||||
exit(0);
|
||||
|
||||
// test library functions
|
||||
|
||||
if (zone == 1) {
|
||||
@ -1434,10 +1463,10 @@ int main() {
|
||||
static QList<int> const timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg);
|
||||
qCritical() << "TimeSteps" << timeSteps;
|
||||
|
||||
if (stepsConfigured != timeSteps) {
|
||||
qCritical() << "TIME-STEPS SHOULD BE" << stepsConfigured;
|
||||
return -1;
|
||||
}
|
||||
//if (stepsConfigured != timeSteps) {
|
||||
// qCritical() << "TIME-STEPS SHOULD BE" << stepsConfigured;
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
QDateTime start = QDateTime::currentDateTime();
|
||||
|
||||
@ -1445,7 +1474,8 @@ int main() {
|
||||
double price1 = 0;
|
||||
double price2 = 0;
|
||||
|
||||
for (int m=0; m < 1440; ++m) {
|
||||
//for (int m=0; m < 1440; ++m) {
|
||||
for (int m=480; m < 481; ++m) {
|
||||
start.setTime(QTime(0, 0, 0));
|
||||
start = start.addSecs(m*60);
|
||||
|
||||
@ -1462,7 +1492,7 @@ int main() {
|
||||
//}
|
||||
|
||||
CalcState cs;
|
||||
|
||||
#if 1
|
||||
for (int i = 0, j=timeSteps.size() ; i < timeSteps.size(); --j, ++i) {
|
||||
QDateTime end = start.addSecs(timeSteps.at(i)*60);
|
||||
|
||||
@ -1497,6 +1527,21 @@ int main() {
|
||||
// cost[i], false, true);
|
||||
//qCritical() << "duration" << duration.c_str();
|
||||
}
|
||||
#else
|
||||
|
||||
double cost = 80;
|
||||
qCritical() << "START" << start.toString(Qt::ISODate) << "cost" << cost;
|
||||
QDateTime end;
|
||||
|
||||
cs = compute_duration_for_parking_ticket(&cfg, start, cost, end,
|
||||
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
|
||||
qCritical() << __LINE__ << cs.toString()
|
||||
<< "START" << start.toString(Qt::ISODate)
|
||||
<< "<duration" << start.secsTo(end) / 60
|
||||
<< "cost" << cost
|
||||
<< "> end" << end.toString(Qt::ISODate);
|
||||
//}
|
||||
#endif
|
||||
}
|
||||
} // zone == 1
|
||||
if (zone == 2) {
|
||||
@ -1534,18 +1579,18 @@ int main() {
|
||||
bool fail;
|
||||
QDateTime start;
|
||||
|
||||
for (int i=0; i < 4; ++i) {
|
||||
for (int i=1; i < 2; ++i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
start = QDateTime(QDate(2024, 5, 1), QTime(16, 0, 0)); // holiday
|
||||
fail = false;
|
||||
break;
|
||||
case 1:
|
||||
start = QDateTime(QDate(2024, 4, 21), QTime(16, 0, 0)); // sunday
|
||||
start = QDateTime(QDate(2024, 10, 3), QTime(17, 0, 0)); // sunday
|
||||
fail = false;
|
||||
break;
|
||||
case 2:
|
||||
start = QDateTime(QDate(2024, 4, 22), QTime(8, 0, 0)); // monday
|
||||
start = QDateTime(QDate(2024, 4, 22), QTime(17, 30, 0)); // monday
|
||||
fail = false;
|
||||
break;
|
||||
case 3:
|
||||
@ -1569,18 +1614,52 @@ int main() {
|
||||
|
||||
QList<int>::const_iterator step;
|
||||
for (step = timeSteps.cbegin(); step != timeSteps.cend(); ++step) {
|
||||
//qCritical() << __LINE__
|
||||
// << "START" << start.toString(Qt::ISODate)
|
||||
// << "<duration" << *step;
|
||||
|
||||
// if (*step != 180)
|
||||
// continue;
|
||||
|
||||
|
||||
double cost = 0;
|
||||
CalcState cs;
|
||||
|
||||
if ((cs = compute_price_for_parking_ticket(&cfg, start, *step, end, &price, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING)))) {
|
||||
QDateTime s(start);
|
||||
|
||||
qCritical() << __LINE__
|
||||
<< "START" << start.toString(Qt::ISODate)
|
||||
<< "<duration" << *step;
|
||||
|
||||
#if 0
|
||||
if ((cs = compute_price_for_parking_ticket(&cfg, s, *step, end, &price,
|
||||
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING)))) {
|
||||
cost = price.netto;
|
||||
qCritical() << "step" << *step << ": cost" << cost;
|
||||
qCritical() << __LINE__
|
||||
<< "START" << start.toString(Qt::ISODate)
|
||||
<< "<duration" << *step
|
||||
<< "cost" << cost
|
||||
<< "> end" << end.toString(Qt::ISODate);
|
||||
} else {
|
||||
if (fail == false) {
|
||||
qCritical() << "<<<ERROR>>> cs =" << QString(cs);
|
||||
}
|
||||
}
|
||||
#else
|
||||
cost = 210;
|
||||
qCritical() << "START" << start.toString(Qt::ISODate) << "cost" << cost;
|
||||
|
||||
cs = compute_duration_for_parking_ticket(&cfg, start, cost, end,
|
||||
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
|
||||
qCritical() << __LINE__ << cs.toString()
|
||||
<< "START" << start.toString(Qt::ISODate)
|
||||
<< "<duration" << start.secsTo(end) / 60
|
||||
<< "cost" << cost
|
||||
<< "> end" << end.toString(Qt::ISODate);
|
||||
break;
|
||||
//}
|
||||
#endif
|
||||
|
||||
}
|
||||
} else {
|
||||
qCritical() << "ERROR paymentOptionIndex =" << paymentOptionIndex;
|
||||
|
@ -30,9 +30,7 @@ SOURCES += main.cpp
|
||||
# HEADERS +=
|
||||
|
||||
OTHER_FILES += \
|
||||
/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff01.json \
|
||||
/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff02.json \
|
||||
/opt/ptu5/opt/customer_502/etc/psa_tariff/tariff03.json
|
||||
/opt/ptu5/opt/customer_249/etc/psa_tariff/tariff02.json
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user