Added test cases for Fuchs/Schnals

This commit is contained in:
Gerhard Hoffmann 2024-08-12 09:24:48 +02:00
parent 6d6615b81e
commit 5131892744

View File

@ -49,9 +49,9 @@ extern "C" char* strptime(const char* s,
#define NEUHAUSER_STOCKERAU (0) #define NEUHAUSER_STOCKERAU (0)
#define KLEIPEDA_LITAUEN (0) #define KLEIPEDA_LITAUEN (0)
#define SEXTEN (0) #define SEXTEN (0)
#define SCHNALS_LEITER_KIRCHL (0) #define SCHNALS_LEITER_KIRCHL (1)
#define SCHNALS_STAUMAUER (SCHNALS_LEITER_KIRCHL) #define SCHNALS_STAUMAUER (SCHNALS_LEITER_KIRCHL)
#define VALSER_ALM (1) #define VALSER_ALM (0)
#if NEUHAUSER_KIRCHDORF==1 #if NEUHAUSER_KIRCHDORF==1
static bool test_neuhauser_kirchdorf(int step, double cost) { static bool test_neuhauser_kirchdorf(int step, double cost) {
@ -575,8 +575,8 @@ int main() {
int pop_max_price; int pop_max_price;
int pop_daily_card_price; int pop_daily_card_price;
//input.open("/home/linux/customer_505/etc/psa_tariff/tariff01.json"); input.open("/home/linux/customer_505/etc/psa_tariff/tariff01.json");
input.open("/opt/ptu5/opt/customer_505/etc/psa_tariff/tariff01.json"); //input.open("/opt/ptu5/opt/customer_505/etc/psa_tariff/tariff01.json");
std::stringstream sstr; std::stringstream sstr;
while(input >> sstr.rdbuf()); while(input >> sstr.rdbuf());
@ -588,10 +588,13 @@ int main() {
cout << endl; cout << endl;
if (isParsed) { if (isParsed) {
pop_min_time = get_minimal_parkingtime(&cfg); //PermitType permitType(PERMIT_TYPE::SHORT_TERM_PARKING);
pop_max_time = get_maximal_parkingtime(&cfg); PermitType permitType(PERMIT_TYPE::DAY_TICKET_PKW);
pop_min_price = get_minimal_parkingprice(&cfg);
pop_max_price = get_maximal_parkingprice(&cfg); pop_min_time = get_minimal_parkingtime(&cfg, permitType);
pop_max_time = get_maximal_parkingtime(&cfg, permitType);
pop_min_price = get_minimal_parkingprice(&cfg, permitType);
pop_max_price = get_maximal_parkingprice(&cfg, permitType);
pop_daily_card_price = cfg.getPaymentOptions().pop_daily_card_price; pop_daily_card_price = cfg.getPaymentOptions().pop_daily_card_price;
qCritical() << " pop_min_time: " << pop_min_time; qCritical() << " pop_min_time: " << pop_min_time;
@ -649,10 +652,10 @@ int main() {
} }
//for (int minutes = 0; minutes < 1440; ++minutes) { //for (int minutes = 0; minutes < 1440; ++minutes) {
for (int minutes = 1020; minutes <= 1020; minutes += 1) { for (int minutes = 480; minutes <= 480; minutes += 1) {
QDateTime start = s.addSecs(minutes * 60); QDateTime start = s.addSecs(minutes * 60);
qCritical() << "start" << start.toString(Qt::ISODate); // qCritical() << "start" << start.toString(Qt::ISODate);
QDateTime effectiveStart = start; QDateTime effectiveStart = start;
@ -669,8 +672,7 @@ int main() {
} }
#if 0 #if 0
PermitType permitType(PERMIT_TYPE::SHORT_TERM_PARKING); for (int i = 700; i <= 1400; i += 700) {
for (int i = 200; i <= 200; i += 10) {
cost = i; cost = i;
if ((cs = compute_duration_for_parking_ticket(&cfg, start, cost, end, permitType))) { // return value if ((cs = compute_duration_for_parking_ticket(&cfg, start, cost, end, permitType))) { // return value
@ -682,38 +684,20 @@ int main() {
// qCritical() << cs.toString(); // qCritical() << cs.toString();
} }
qCritical() << "start" << start.toString(Qt::ISODate) << "< cost" << cost //qCritical() << "start" << start.toString(Qt::ISODate) << "< cost" << cost
<< "> end" << end.toString(Qt::ISODate); // << "> end" << end.toString(Qt::ISODate);
} }
#else #else
for (int i = 700; i <= 1400; i += 700) {
//for (int i = 2100; i <= 2100; i += 10) {
cost = i;
if ((cs = compute_duration_for_parking_ticket(&cfg, start, cost, end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW)))) { // return value
}
if (!cs) {
qCritical() << "ERROR CalcState" << cs.toString() << endl;
} else {
// qCritical() << cs.toString();
}
qCritical() << "start" << start.toString(Qt::ISODate) << "< cost" << cost
<< "> end" << end.toString(Qt::ISODate);
}
#endif
#if 0
start = QDateTime::currentDateTime(); start = QDateTime::currentDateTime();
start.setTime(QTime(9, 57, 0)); //start.setTime(QTime(9, 57, 0));
for (int i = 66; i <= 66; i += 6) { for (int netto_parking_time = 60; netto_parking_time <= 60; netto_parking_time += 60) {
QDateTime end; QDateTime end;
struct price_t price; struct price_t price;
cs = compute_price_for_parking_ticket(&cfg, start, i, end, &price); cs = compute_price_for_parking_ticket(&cfg, start, netto_parking_time, end, &price, permitType, true);
qCritical() << "start" << start.toString(Qt::ISODate) << "end" << end.toString(Qt::ISODate) qCritical() << "start" << start.toString(Qt::ISODate) << "end" << end.toString(Qt::ISODate)
<< "price" << price.netto; << "price" << price.netto;