Added sone test code for Schoenau, Koenigsee.
This commit is contained in:
parent
10b018a338
commit
86c27986cc
@ -24,10 +24,16 @@ extern "C" char* strptime(const char* s,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "calculate_price.h"
|
#include "calculate_price.h"
|
||||||
|
#include "calculator_functions.h"
|
||||||
|
#include "payment_method.h"
|
||||||
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
|
|
||||||
|
static Calculator calculator;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
parking_tariff_t *tariff = 0;
|
parking_tariff_t *tariff = 0;
|
||||||
@ -37,24 +43,27 @@ int main() {
|
|||||||
memset(&price, 0x00, sizeof(price));
|
memset(&price, 0x00, sizeof(price));
|
||||||
// QDateTime start = QDateTime::fromString("2023-06-01T07:50:00.000Z",Qt::ISODate); //QDateTime::currentDateTime();
|
// QDateTime start = QDateTime::fromString("2023-06-01T07:50:00.000Z",Qt::ISODate); //QDateTime::currentDateTime();
|
||||||
QDateTime start = QDateTime::currentDateTime();
|
QDateTime start = QDateTime::currentDateTime();
|
||||||
time_t start_parking_time = start.toSecsSinceEpoch() / 60;
|
// time_t start_parking_time = start.toSecsSinceEpoch() / 60;
|
||||||
|
|
||||||
// zone 1
|
// zone 1
|
||||||
int timeSteps[9] = {60, 180, 1440, 2880, 4320, 5670, 7200, 8640, 10080};
|
//int timeSteps[9] = {60, 180, 1440, 2880, 4320, 5670, 7200, 8640, 10080};
|
||||||
|
|
||||||
// zone 2
|
// zone 2
|
||||||
//int timeSteps[3] = {60, 180, 1440};
|
//int timeSteps[3] = {60, 180, 1440};
|
||||||
|
|
||||||
for (int i = 0 ; i < sizeof(timeSteps)/sizeof(int); ++i) {
|
static QList<int> const timeSteps = calculator.GetTimeSteps(tariff, PaymentMethod::Steps);
|
||||||
time_t end_parking_time = start_parking_time + timeSteps[i];
|
|
||||||
|
|
||||||
if (compute_price_for_parking_ticket(tariff,
|
qCritical() << timeSteps;
|
||||||
start_parking_time,
|
|
||||||
end_parking_time,
|
for (int i = 0 ; i < timeSteps.size(); ++i) {
|
||||||
&price))
|
// time_t end_parking_time = start_parking_time + timeSteps[i];
|
||||||
{
|
QDateTime end = start.addSecs(timeSteps.at(i)*60);
|
||||||
qDebug() << "GetCostFromDuration() time: " << timeSteps[i] << "price=" << price.netto;
|
|
||||||
}
|
double price = calculator.GetCostFromDuration(tariff,
|
||||||
|
start,
|
||||||
|
timeSteps.at(i),
|
||||||
|
PaymentMethod::Steps);
|
||||||
|
qDebug() << "GetCostFromDuration() time: " << timeSteps.at(i) << "price=" << price;
|
||||||
}
|
}
|
||||||
|
|
||||||
free_tariff(tariff);
|
free_tariff(tariff);
|
||||||
|
Loading…
Reference in New Issue
Block a user