main: add test for GetDurationFromCost
This commit is contained in:
parent
46bffc250d
commit
1069c5ad90
@ -27,9 +27,43 @@ extern "C" char* strptime(const char* s,
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include "calculator_functions.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
|
std::ifstream input(QDir::homePath().append("/tariff01.json").toStdString());
|
||||||
|
std::stringstream sstr;
|
||||||
|
while(input >> sstr.rdbuf());
|
||||||
|
std::string json(sstr.str());
|
||||||
|
|
||||||
|
Calculator calculator;
|
||||||
|
Configuration cfg;
|
||||||
|
|
||||||
|
bool isParsed = cfg.ParseJson(&cfg, json.c_str());
|
||||||
|
cout << endl;
|
||||||
|
|
||||||
|
char const *startDate = "";
|
||||||
|
|
||||||
|
if (isParsed)
|
||||||
|
{
|
||||||
|
startDate = "2023-05-10T13:52:18.665Z";
|
||||||
|
std::string duration = calculator.GetDurationFromCost(&cfg, 3, (char *)startDate, 33, false, true);
|
||||||
|
cout << "---> startDate " << startDate << " _price_ = " << 33
|
||||||
|
<< " Total duration is: " << duration << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
parking_tariff_t *tariff = 0;
|
parking_tariff_t *tariff = 0;
|
||||||
if (init_tariff(&tariff, "/etc/psa_tariff/")) {
|
if (init_tariff(&tariff, "/etc/psa_tariff/")) {
|
||||||
struct price_t price;
|
struct price_t price;
|
||||||
|
Loading…
Reference in New Issue
Block a user