Added some testcases
This commit is contained in:
		@@ -18,13 +18,15 @@ int main() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    parking_tariff_t *tariff =
 | 
			
		||||
        parking_tariff_t::parseTariff("/opt/ptu5/opt/calculate_parking/calculate_parking_tickets/germersheim.conf");
 | 
			
		||||
        //parking_tariff_t::parseTariff("/opt/ptu5/opt/calculate_parking/calculate_parking_tickets/germersheim.conf");
 | 
			
		||||
        parking_tariff_t::parseTariff("/opt/ptu5/opt/calculate_parking/calculate_parking_tickets/apcoa_prio_1.conf");
 | 
			
		||||
 | 
			
		||||
    if (tariff) {
 | 
			
		||||
        price_t price;
 | 
			
		||||
        memset(&price, 0x00, sizeof(price));
 | 
			
		||||
        QDateTime start = QDateTime::currentDateTime();
 | 
			
		||||
        QDateTime end;
 | 
			
		||||
        QDateTime st = start;
 | 
			
		||||
        QDateTime end, tmp;
 | 
			
		||||
        start.setTime(QTime());
 | 
			
		||||
        int d1, d2 = 0;
 | 
			
		||||
 | 
			
		||||
@@ -34,7 +36,9 @@ int main() {
 | 
			
		||||
 | 
			
		||||
        for (int h = 0; h < 6; ++h) {
 | 
			
		||||
            for (int i = 0; i < MIN_PER_DAY; ++i) {
 | 
			
		||||
                fprintf(stderr, "\n*** %5d *** (parkdauer:%dh)", i*(h+1), hour[h]);
 | 
			
		||||
                //int __x = i*(h+1);
 | 
			
		||||
                //if (__x == 3060) {
 | 
			
		||||
                fprintf(stderr, "\n*** %d:%d *** (parkdauer:%dh)", h, i, hour[h]);
 | 
			
		||||
 | 
			
		||||
                if (d1 != d2) {
 | 
			
		||||
                    qDebug() << ((i==0) ? 0: i/MIN_PER_DAY) << d1 << "***\n";
 | 
			
		||||
@@ -44,25 +48,30 @@ int main() {
 | 
			
		||||
                //start = start.addSecs(i*60);
 | 
			
		||||
                //start = start.addSecs(420*60);
 | 
			
		||||
                minute_t const s = TUtils::toMinutes(start);
 | 
			
		||||
                end = start.addSecs(hour[h]*60*60);
 | 
			
		||||
                tmp = start;
 | 
			
		||||
                end = tmp.addSecs(hour[h]*60*60);
 | 
			
		||||
                minute_t const e = TUtils::toMinutes(end);
 | 
			
		||||
                //minute_t const e = s + 24*60*3 + 123;
 | 
			
		||||
 | 
			
		||||
                fprintf(stderr,
 | 
			
		||||
                    "[EINFAHRT: %s:%02d:%02d, %ld Minuten frei, "
 | 
			
		||||
                    "[EINFAHRT: %s:%02d:%02d, (day:%ld,night:%ld) Minuten frei, "
 | 
			
		||||
                    "AUSFAHRT: %s:%02d:%02d]\n",
 | 
			
		||||
                    start.date().toString().toStdString().c_str(),
 | 
			
		||||
                    start.time().hour(), start.time().minute(),
 | 
			
		||||
                    tariff->free_of_charge,
 | 
			
		||||
                    tariff->free_of_charge_day_tariff,
 | 
			
		||||
                    tariff->free_of_charge_night_tariff,
 | 
			
		||||
                    end.date().toString().toStdString().c_str(),
 | 
			
		||||
                    end.time().hour(), end.time().minute());
 | 
			
		||||
 | 
			
		||||
                if (compute_price_for_parking_ticket(tariff, s, e, &price)) {
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                //}
 | 
			
		||||
                start = start.addSecs(60);
 | 
			
		||||
                d1 = start.date().dayOfWeek();
 | 
			
		||||
            }
 | 
			
		||||
            start = st;
 | 
			
		||||
            d1 = start.date().dayOfWeek();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user