Files
pip/main.cpp
2024-05-06 19:22:22 +03:00

71 lines
1.7 KiB
C++

#include "pibytearray.h"
#include "picodeparser.h"
#include "piiostream.h"
#include "pijson.h"
#include "piliterals_time.h"
#include "pimathbase.h"
#include "pip.h"
#include "pivaluetree_conversions.h"
using namespace PICoutManipulators;
int main(int argc, char * argv[]) {
/*PISerial ser;
ser.setSpeed(PISerial::S115200);
piCout << ser.open("COM15", PIIODevice::ReadWrite);
CONNECTL(&ser, threadedReadEvent, ([](const uchar * data, ssize_t size) { piCout << PIByteArray(data, size); }));
ser.startThreadedRead();
(2_s).sleep();
ser.stopAndWait();*/
/*auto test = [](PISystemTime t) {
piCout << "---------------";
piCout << t << t.toString();
piCout << PISystemTime::fromString(t.toString()) << PISystemTime::fromString(t.toString()).toString();
piCout << PIVariant(t);
piCout << PIVariant(t).toString();
};
auto test_str = [](PIString s) {
piCout << "---------------";
piCout << s;
piCout << PISystemTime::fromString(s) << PISystemTime::fromString(s).toString();
};
test(PISystemTime::current());
test(1000.123_d);
test(61_s);
test(59_s);
test(1234_us);
test(5000001_ns);
test_str("");
test_str("2020-05-04");
test_str("2020-05-04 11:12:13");
test_str("11:12:13");
test_str("11:12:13.405");
test_str("100");
test_str("5 s");
test_str("5s");
test_str("1000 d 2 h 57 m 7 s 200 ms 2 ns");
test_str("0.2 d");
test_str(".5d");
test_str("3E+2us");
test_str("0.1d 200millis");
test_str("2h 15 seconds");
test_str("4secs 2hours 100 ns 3m 5ms 1 day 6 micros ");
test_str("1hz");
test_str("5.123khz");
test_str("5khz 123 hz");
test_str("2mhz");
test_str("1ghz");
test_str("1hz 1hz");*/
// PIPair<int, PIString> p = createPIPair(0, "");
PIVector<PIPair<int, PIString>> pv;
pv << createPIPair(0, PIString());
return 0;
}