From 94e962bb459517cddd6b287ed23821a136bf42af Mon Sep 17 00:00:00 2001 From: "xanthos@durruti" Date: Mon, 16 Sep 2024 12:49:41 +0300 Subject: [PATCH] changing to cmake --- .github/workflows/cpp-linux-build.yml | 32 +--- CMakeLists.txt | 26 ++++ {src => include}/calendar.hpp | 0 {src => include}/cdatetime.hpp | 0 {src => include}/datetime_io_core.hpp | 0 {src => include}/datetime_read.hpp | 0 {src => include}/datetime_tops.hpp | 14 +- {src => include}/datetime_write.hpp | 23 +-- {src => include}/dtconcepts.hpp | 0 {src => include}/dtdatetime.hpp | 20 +-- {src => include}/dtfund.hpp | 48 +++--- {src => include}/hms_time.hpp | 0 {src => include}/tpdate.hpp | 22 ++- {src => include}/tpdate2.hpp | 0 run_test_suite.py | 92 ------------ src/CMakeLists.txt | 32 ++++ src/datetime_io_core.cpp | 3 +- test/unit_tests/CMakeLists.txt | 162 +++++++++++++++++++++ test/unit_tests/datetime.cpp | 7 +- test/unit_tests/datetime_addition.cpp | 14 +- test/unit_tests/datetime_addition_sec.cpp | 7 +- test/unit_tests/datetime_addition_sec2.cpp | 29 ++-- test/unit_tests/datetime_diff.cpp | 18 +-- test/unit_tests/dread3.cpp | 3 - test/unit_tests/dwrite9.cpp | 5 - test/unit_tests/leapday.cpp | 4 - test/unit_tests/mjd.cpp | 3 - test/unit_tests/tpdate_add.cpp | 2 - test/unit_tests/tpdates1.cpp | 2 - test/unit_tests/tpdates2.cpp | 2 - test/unit_tests/tpdates3.cpp | 2 - test/unit_tests/tpdates4.cpp | 2 - 32 files changed, 333 insertions(+), 241 deletions(-) create mode 100644 CMakeLists.txt rename {src => include}/calendar.hpp (100%) rename {src => include}/cdatetime.hpp (100%) rename {src => include}/datetime_io_core.hpp (100%) rename {src => include}/datetime_read.hpp (100%) rename {src => include}/datetime_tops.hpp (97%) rename {src => include}/datetime_write.hpp (92%) rename {src => include}/dtconcepts.hpp (100%) rename {src => include}/dtdatetime.hpp (99%) rename {src => include}/dtfund.hpp (98%) rename {src => include}/hms_time.hpp (100%) rename {src => include}/tpdate.hpp (98%) rename {src => include}/tpdate2.hpp (100%) delete mode 100755 run_test_suite.py create mode 100644 src/CMakeLists.txt create mode 100644 test/unit_tests/CMakeLists.txt diff --git a/.github/workflows/cpp-linux-build.yml b/.github/workflows/cpp-linux-build.yml index 2bc7691..bbe051d 100644 --- a/.github/workflows/cpp-linux-build.yml +++ b/.github/workflows/cpp-linux-build.yml @@ -14,29 +14,9 @@ jobs: steps: - uses: actions/checkout@v3 - - name: install scons - run: sudo apt-get install -y scons - - - name: install (latest) eigen - run: sudo apt install libeigen3-dev - - - name: build (production), gcc - run: scons - - - name: build (production, c++20), gcc - run: scons --std=20 - - - name: build (debug), gcc - run: scons debug=1 - - - name: build (debug & tests), gcc - run: scons debug=1 test=1 - - - name: build (production), clang - run: scons --cxx=clang++ - - - name: build (debug & tests), clang - run: scons debug=1 test=1 --cxx=clang++ - - - name: build (production, C++20), clang - run: scons --cxx=clang++ --std=20 + - name: "prepare build (production/standard), gcc" + run: cmake -S . -B build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release + - name: "build" + run: cmake --build build --target all --config Release -- -j4 + - name: "Test" + run: ctest --test-dir build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b213079 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.1) + +project( + datetime + VERSION 1.1.0 + DESCRIPTION "DateTime Library for Satellite Geoddesy" + LANGUAGES CXX +) + +# The library +add_subdirectory(src) + +# The tests +include(CTest) +add_subdirectory(test//unit_tests) +enable_testing() + +add_compile_options( + -Wall -Wextra -Werror -pedantic -W -Wshadow -march=native + $<$:-O2 -march=native> + $<$:-g -pg -Wdisabled-optimization -DDEBUG> +) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED On) +set(CMAKE_CXX_EXTENSIONS Off) diff --git a/src/calendar.hpp b/include/calendar.hpp similarity index 100% rename from src/calendar.hpp rename to include/calendar.hpp diff --git a/src/cdatetime.hpp b/include/cdatetime.hpp similarity index 100% rename from src/cdatetime.hpp rename to include/cdatetime.hpp diff --git a/src/datetime_io_core.hpp b/include/datetime_io_core.hpp similarity index 100% rename from src/datetime_io_core.hpp rename to include/datetime_io_core.hpp diff --git a/src/datetime_read.hpp b/include/datetime_read.hpp similarity index 100% rename from src/datetime_read.hpp rename to include/datetime_read.hpp diff --git a/src/datetime_tops.hpp b/include/datetime_tops.hpp similarity index 97% rename from src/datetime_tops.hpp rename to include/datetime_tops.hpp index dbb3922..f9dcc0a 100644 --- a/src/datetime_tops.hpp +++ b/include/datetime_tops.hpp @@ -427,13 +427,13 @@ constexpr Strg cast_to(Ssrc s) noexcept { Ssrc::template sec_factor(); return Strg(s.__member_ref__() * factor); } else { - // this is tricky! We must first compute the numerator and then the fraction. - // why? check this out - // seconds _s1 = cast_to(milliseconds{2000L}); - // this is: (1/1000)*2000 which is 0 because 1/1000 is 0, but - // (2000*1)/1000 = 2 which is correct - const auto numerator = s.__member_ref__() * Strg::template sec_factor(); - return Strg(numerator / Ssrc::template sec_factor()); + // this is tricky! We must first compute the numerator and then the + // fraction. why? check this out seconds _s1 = cast_to(milliseconds{2000L}); this is: (1/1000)*2000 which is 0 because + // 1/1000 is 0, but (2000*1)/1000 = 2 which is correct + const auto numerator = + s.__member_ref__() * Strg::template sec_factor(); + return Strg(numerator / Ssrc::template sec_factor()); } } diff --git a/src/datetime_write.hpp b/include/datetime_write.hpp similarity index 92% rename from src/datetime_write.hpp rename to include/datetime_write.hpp index d9c2257..9cf86c6 100644 --- a/src/datetime_write.hpp +++ b/include/datetime_write.hpp @@ -22,11 +22,11 @@ template class SpitDate {}; template <> class SpitDate { public: static const int numChars = 10; - static int spit(const ymd_date &ymd, char *buffer, char delimeter='/') noexcept { - return std::sprintf(buffer, "%4d%c%02d%c%02d", ymd.yr().as_underlying_type(), - delimeter, - ymd.mn().as_underlying_type(), - delimeter, + static int spit(const ymd_date &ymd, char *buffer, + char delimeter = '/') noexcept { + return std::sprintf(buffer, "%4d%c%02d%c%02d", + ymd.yr().as_underlying_type(), delimeter, + ymd.mn().as_underlying_type(), delimeter, ymd.dm().as_underlying_type()); } }; @@ -35,11 +35,11 @@ template <> class SpitDate { template <> class SpitDate { public: static const int numChars = 10; - static int spit(const ymd_date &ymd, char *buffer, char delimeter='/') noexcept { - return std::sprintf(buffer, "%02d%c%02d%c%4d", ymd.dm().as_underlying_type(), - delimeter, - ymd.mn().as_underlying_type(), - delimeter, + static int spit(const ymd_date &ymd, char *buffer, + char delimeter = '/') noexcept { + return std::sprintf(buffer, "%02d%c%02d%c%4d", + ymd.dm().as_underlying_type(), delimeter, + ymd.mn().as_underlying_type(), delimeter, ymd.yr().as_underlying_type()); } }; @@ -60,7 +60,8 @@ template <> class SpitDate { * to represent the date * @return On success, a pointer to \p buffer */ -template const char *to_char(const ymd_date &ymd, char *buffer, char delimeter='/') { +template +const char *to_char(const ymd_date &ymd, char *buffer, char delimeter = '/') { if (SpitDate::spit(ymd, buffer, delimeter) != SpitDate::numChars) { throw std::runtime_error("[ERROR] Failed to format date to string\n"); } diff --git a/src/dtconcepts.hpp b/include/dtconcepts.hpp similarity index 100% rename from src/dtconcepts.hpp rename to include/dtconcepts.hpp diff --git a/src/dtdatetime.hpp b/include/dtdatetime.hpp similarity index 99% rename from src/dtdatetime.hpp rename to include/dtdatetime.hpp index c1c65b6..4ff816d 100644 --- a/src/dtdatetime.hpp +++ b/include/dtdatetime.hpp @@ -84,7 +84,7 @@ class datetime_interval { public: /** Default constructor (everything set to 0). */ - explicit constexpr datetime_interval() noexcept : m_days(0), m_secs(0){}; + explicit constexpr datetime_interval() noexcept : m_days(0), m_secs(0) {}; /** Constructor from number of days and number of *seconds. * @@ -268,7 +268,7 @@ class datetime { * the user intents to use this function. */ datetime(modified_julian_day mjd, S sec, [[maybe_unused]] char c) noexcept - : m_mjd(mjd), m_sec(sec){}; + : m_mjd(mjd), m_sec(sec) {}; public: /** Expose the underlying sec type S */ @@ -296,7 +296,7 @@ class datetime { } /** Default constructor. */ - explicit constexpr datetime() noexcept : m_mjd(dso::J2000_MJD), m_sec(0){}; + explicit constexpr datetime() noexcept : m_mjd(dso::J2000_MJD), m_sec(0) {}; double jcenturies_sinceJ2000() const noexcept { const double d_mjd = (double)(m_mjd.as_underlying_type()); @@ -543,8 +543,7 @@ class datetime { /** @brief Cast to double (i.e. fractional) Modified Julian Date. */ constexpr double fmjd() const noexcept { - return static_cast(m_mjd.as_underlying_type()) + - fractional_days(); + return static_cast(m_mjd.as_underlying_type()) + fractional_days(); } /** @brief Cast to double (i.e. fractional) Julian Date. */ @@ -614,7 +613,7 @@ class datetime { [[nodiscard]] constexpr datetime tai2gps() const noexcept { return datetime(m_mjd, m_sec - dso::cast_to(seconds(19))); } - + [[nodiscard]] constexpr datetime tt2gps() const noexcept { return datetime(m_mjd, m_sec - dso::cast_to( milliseconds(19000 + 32184))); @@ -674,7 +673,7 @@ class datetime { modified_julian_day m_mjd; /** Modified Julian Day */ S m_sec; /** Time of day in S precision. */ -}; /* datetime */ +}; /* datetime */ #if __cplusplus >= 202002L template @@ -703,7 +702,8 @@ class datetimeUtc { } /** Default constructor. */ - explicit constexpr datetimeUtc() noexcept : m_mjd(dso::J2000_MJD), m_sec(0){}; + explicit constexpr datetimeUtc() noexcept + : m_mjd(dso::J2000_MJD), m_sec(0) {}; /** Constructor from year, month, day of month and sec type. * If an invalid date is passed-in, the constructor will throw. @@ -875,7 +875,7 @@ class datetimeUtc { * Remove whole days of from the time part and add them to the date part. */ constexpr void normalize() noexcept { - int extra_sec_in_day; + int extra_sec_in_day = 0; dat(m_mjd, extra_sec_in_day); /* for each MJD, remove integral days. Each MJD may have a different * number of seconds, since we are in UTC time scale. Hence, iteratively @@ -948,7 +948,7 @@ class datetimeUtc { modified_julian_day m_mjd; /** Modified Julian Day */ S m_sec; /** Time of day in S precision. */ -}; /* datetimeUtc */ +}; /* datetimeUtc */ template , diff --git a/src/dtfund.hpp b/include/dtfund.hpp similarity index 98% rename from src/dtfund.hpp rename to include/dtfund.hpp index 70766ef..feacae2 100644 --- a/src/dtfund.hpp +++ b/include/dtfund.hpp @@ -264,7 +264,7 @@ int dat(modified_julian_day mjd, int &extra_sec_in_day) noexcept; /** A simple struct to signal fractional seconds; just to secure type safety */ struct FractionalSeconds { double fsec; - FractionalSeconds(double _fsec = 0e0) noexcept : fsec(_fsec){}; + FractionalSeconds(double _fsec = 0e0) noexcept : fsec(_fsec) {}; }; /* FractionalSeconds */ /** A simple struct to signal fractional days; just to secure type safety */ @@ -409,7 +409,7 @@ class month { * you can practically assign month=123. If you want a validity check, use * the month::is_valid function (after construction). */ - explicit constexpr month(underlying_type i = 1) noexcept : m_month(i){}; + explicit constexpr month(underlying_type i = 1) noexcept : m_month(i) {}; /** @brief Constructor from a c-string. * Given a c-string (i.e. null-terminating char array), resolve the month. @@ -523,7 +523,7 @@ class gps_week { * This is an explicit constructor, we do not want users to be able to do * gps_week w = 1; */ - explicit constexpr gps_week(underlying_type i = 1) noexcept : m_week(i){}; + explicit constexpr gps_week(underlying_type i = 1) noexcept : m_week(i) {}; /** Overload operator '=' where the the right-hand-side is any integral type. * @tparam I any integral type, aka any type for which std::is_integral_v @@ -595,7 +595,7 @@ class day_of_month { * information, one can use the is_valid method to test if the day of month * is valid. */ - explicit constexpr day_of_month(underlying_type i = 1) noexcept : m_dom(i){}; + explicit constexpr day_of_month(underlying_type i = 1) noexcept : m_dom(i) {}; /** Overload operator '=' where the the right-hand-side is any integral type. * @tparam I any integral type, aka any type for which std::is_integral_v @@ -683,7 +683,7 @@ class day_of_year { * check for an invalid day of year, then use the is_valid method (after * instance construction). * */ - explicit constexpr day_of_year(underlying_type i = 0) noexcept : m_doy(i){}; + explicit constexpr day_of_year(underlying_type i = 0) noexcept : m_doy(i) {}; /** Overload operator '=' where the the right-hand-side is any integral type. * @tparam I any integral type, aka any type for which std::is_integral_v @@ -781,7 +781,7 @@ class ymd_date { year __year; /** the year */ month __month; /** the month */ day_of_month __dom; /** day of month */ -}; /* ymd_date */ +}; /* ymd_date */ /** @brief This struct represent a date in Year-Day of Year format. * @@ -837,7 +837,7 @@ class ydoy_date { private: year __year; /** the year */ day_of_year __doy; /** day of year */ -}; /* ydoy_date */ +}; /* ydoy_date */ namespace core { /** @brief Modified Julian Day to calendar date @@ -934,7 +934,7 @@ class modified_julian_day { * This is a non-explicit constructor, hence we can perform: * modified_julian_day mjd = 123456; */ - constexpr modified_julian_day(underlying_type i = 1) noexcept : m_mjd(i){}; + constexpr modified_julian_day(underlying_type i = 1) noexcept : m_mjd(i) {}; /** @brief Constructor from Year and DayOfYear. * The passed in date (year and doy) are tested to see if they represent a @@ -947,11 +947,11 @@ class modified_julian_day { * http://www.ngs.noaa.gov/gps-toolbox/bwr-02.htm */ constexpr modified_julian_day(year iy, day_of_year id) - : m_mjd( - core::ydoy2mjd(iy.as_underlying_type(), id.as_underlying_type())){}; + : m_mjd(core::ydoy2mjd(iy.as_underlying_type(), + id.as_underlying_type())) {}; modified_julian_day(const ydoy_date &ydoy) : m_mjd(core::ydoy2mjd(ydoy.yr().as_underlying_type(), - ydoy.dy().as_underlying_type())){}; + ydoy.dy().as_underlying_type())) {}; /** @brief Constructor from calendar date * The passed in date is tested to see if they represent a valid date. If @@ -966,11 +966,11 @@ class modified_julian_day { */ constexpr modified_julian_day(year y, month m, day_of_month d) : m_mjd(core::cal2mjd(y.as_underlying_type(), m.as_underlying_type(), - d.as_underlying_type())){}; + d.as_underlying_type())) {}; modified_julian_day(const ymd_date &ymd) : m_mjd(core::cal2mjd(ymd.yr().as_underlying_type(), ymd.mn().as_underlying_type(), - ymd.dm().as_underlying_type())){}; + ymd.dm().as_underlying_type())) {}; /** Overload operator '=' where the the right-hand-side is any integral type. * @tparam I any integral type, aka any type for which std::is_integral_v @@ -1072,7 +1072,7 @@ class hours { constexpr underlying_type &__member_ref__() noexcept { return m_hours; } /** Constructor; default hours is 0, but any hour will do */ - explicit constexpr hours(underlying_type i = 0) noexcept : m_hours(i){}; + explicit constexpr hours(underlying_type i = 0) noexcept : m_hours(i) {}; /** Overload operator '=' where the the right-hand-side is any integral type. * @tparam I any integral type, aka any type for which std::is_integral_v @@ -1141,7 +1141,7 @@ class minutes { constexpr underlying_type &__member_ref__() noexcept { return m_min; } /** Constructor; any integral number will do */ - explicit constexpr minutes(underlying_type i = 0) noexcept : m_min(i){}; + explicit constexpr minutes(underlying_type i = 0) noexcept : m_min(i) {}; /** Overload operator '=' where the the right-hand-side is any integral type. * @tparam I any integral type, aka any type for which std::is_integral_v @@ -1234,7 +1234,7 @@ class seconds { static constexpr double sec_inv_factor() noexcept { return 1e0; } /** Constructor; default seconds is 0, but any integral will do */ - explicit constexpr seconds(underlying_type i = 0) noexcept : m_sec(i){}; + explicit constexpr seconds(underlying_type i = 0) noexcept : m_sec(i) {}; /** Constructor from hours, minutes, seconds. */ explicit constexpr seconds(hours h, minutes m, seconds c) noexcept @@ -1348,14 +1348,15 @@ class milliseconds { static_assert(max_in_day < std::numeric_limits::max()); /** Constructor; default milliseconds is 0. */ - explicit constexpr milliseconds(underlying_type i = 0L) noexcept : m_sec(i){}; + explicit constexpr milliseconds(underlying_type i = 0L) noexcept + : m_sec(i) {}; /** Constructor from hours, minutes, milliseconds. */ explicit constexpr milliseconds(hours h, minutes m, milliseconds c) noexcept : m_sec(c.as_underlying_type() + (static_cast(m.as_underlying_type()) + static_cast(h.as_underlying_type()) * 60L) * - sec_factor() * 60L){}; + sec_factor() * 60L) {}; /** Overload operator '=' where the the right-hand-side is any integral type. * @tparam I any integral type, aka any type for which std::is_integral_v @@ -1474,14 +1475,15 @@ class microseconds { static constexpr double sec_inv_factor() noexcept { return 1e-6; } /** Constructor; default microseconds is 0; any integral number will do */ - explicit constexpr microseconds(underlying_type i = 0L) noexcept : m_sec(i){}; + explicit constexpr microseconds(underlying_type i = 0L) noexcept + : m_sec(i) {}; /** Constructor from hours, minutes, microseconds. */ explicit constexpr microseconds(hours h, minutes m, microseconds c) noexcept : m_sec(c.as_underlying_type() + (static_cast(m.as_underlying_type()) + static_cast(h.as_underlying_type()) * 60L) * - sec_factor() * 60L){}; + sec_factor() * 60L) {}; /** Overload operator '=' where the the right-hand-side is any integral type. * @tparam I any integral type, aka any type for which std::is_integral_v @@ -1594,14 +1596,14 @@ class nanoseconds { static constexpr double sec_inv_factor() noexcept { return 1e-9; } /** Constructor; default nanoseconds is 0. **/ - explicit constexpr nanoseconds(underlying_type i = 0L) noexcept : m_sec(i){}; + explicit constexpr nanoseconds(underlying_type i = 0L) noexcept : m_sec(i) {}; /** Constructor from hours, minutes, nanoseconds. */ explicit constexpr nanoseconds(hours h, minutes m, nanoseconds c) noexcept : m_sec(c.as_underlying_type() + (static_cast(m.as_underlying_type()) + static_cast(h.as_underlying_type()) * 60L) * - sec_factor() * 60L){}; + sec_factor() * 60L) {}; /** Overload operator '=' where the the right-hand-side is any integral type. * @tparam I any integral type, aka any type for which std::is_integral_v @@ -1698,7 +1700,7 @@ class picoseconds { static constexpr double sec_inv_factor() noexcept { return 1e-12; } /** Constructor; default picoseconds is 0. **/ - explicit constexpr picoseconds(underlying_type i = 0L) noexcept : m_sec(i){}; + explicit constexpr picoseconds(underlying_type i = 0L) noexcept : m_sec(i) {}; /** Cast to picoseconds::underlying_type. */ constexpr underlying_type as_underlying_type() const noexcept { diff --git a/src/hms_time.hpp b/include/hms_time.hpp similarity index 100% rename from src/hms_time.hpp rename to include/hms_time.hpp diff --git a/src/tpdate.hpp b/include/tpdate.hpp similarity index 98% rename from src/tpdate.hpp rename to include/tpdate.hpp index 85e47d6..4c131aa 100644 --- a/src/tpdate.hpp +++ b/include/tpdate.hpp @@ -61,7 +61,7 @@ class TwoPartDateUTC { : _mjd(mjd), _fsec(secday) { normalize(); } - + /** Add seconds to instance, taking into account leap seconds. */ void add_seconds(FDOUBLE sec) noexcept { @@ -121,7 +121,7 @@ class TwoPartDateUTC { /** @brief Transform the (integral part of the) date to Year Month Day */ ymd_date to_ymd() const noexcept { return core::mjd2ymd((long)_mjd); } - + /** Add seconds to instance, taking into account leap seconds. */ void add_seconds(FractionalSeconds fsec) noexcept { @@ -282,7 +282,7 @@ class TwoPartDate { : _mjd(mjd), _fsec(secday) { normalize(); } - + /** Add seconds to instance. * @warning Does not take into account leap seconds. */ @@ -344,17 +344,15 @@ class TwoPartDate { } constexpr explicit TwoPartDate(modified_julian_day mjd) noexcept - : _mjd(mjd.as_underlying_type()), _fsec(0){}; + : _mjd(mjd.as_underlying_type()), _fsec(0) {}; - explicit TwoPartDate(year y, month m, day_of_month d, - double sec_of_day=0e0) + explicit TwoPartDate(year y, month m, day_of_month d, double sec_of_day = 0e0) : _mjd(modified_julian_day(y, m, d).as_underlying_type()), _fsec(sec_of_day) { this->normalize(); } - - explicit TwoPartDate(year y, day_of_year d, - double sec_of_day=0e0) + + explicit TwoPartDate(year y, day_of_year d, double sec_of_day = 0e0) : _mjd(modified_julian_day(y, d).as_underlying_type()), _fsec(sec_of_day) { this->normalize(); @@ -394,7 +392,7 @@ class TwoPartDate { /** @brief Transform the (integral part of the) date to Year Month Day */ ymd_date to_ymd() const noexcept { return core::mjd2ymd((long)_mjd); } - + /** @brief Transform the (integral part of the) date to Year Day-Of-Year */ ydoy_date to_ydoy() const noexcept { const modified_julian_day mjd(_mjd); @@ -461,7 +459,7 @@ class TwoPartDate { TwoPartDate operator-(const modified_julian_day days) const noexcept { return TwoPartDate(_mjd - days.as_underlying_type(), _fsec); } - + /** Add integral days */ TwoPartDate operator+(const modified_julian_day days) const noexcept { return TwoPartDate(_mjd + days.as_underlying_type(), _fsec); @@ -695,7 +693,7 @@ template > inline datetime from_mjdepoch(const TwoPartDate &t) noexcept { dso::nanoseconds nsec(static_cast( t.seconds() * nanoseconds::sec_factor())); - return datetime(t.imjd(), cast_to(nsec)); + return datetime(t.imjd(), cast_to(nsec)); } } /* namespace dso */ diff --git a/src/tpdate2.hpp b/include/tpdate2.hpp similarity index 100% rename from src/tpdate2.hpp rename to include/tpdate2.hpp diff --git a/run_test_suite.py b/run_test_suite.py deleted file mode 100755 index 329d45e..0000000 --- a/run_test_suite.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/python3 - -import os -import sys -import subprocess -import argparse -import ftplib -import importlib.util -import json - -class myFormatter(argparse.ArgumentDefaultsHelpFormatter, - argparse.RawTextHelpFormatter): - pass - - -parser = argparse.ArgumentParser( - formatter_class=myFormatter, - description='Run validatation programs for the ggdatetime library', - epilog=('''National Technical University of Athens, - Dionysos Satellite Observatory\n - Send bug reports to: - Xanthos, xanthos@mail.ntua.gr - Oct, 2023''')) - -parser.add_argument( - '--progs-dir', - metavar='PROGS_DIR', - dest='progs_dir', - default=os.path.abspath(os.path.join(os.getcwd(), 'test')), - required=False, - help='Directory with test executables (top-level test directory)') - -parser.add_argument( - '--data-dir', - metavar='DATA_DIR', - dest='data_dir', - default=os.path.abspath(os.getcwd()), - required=False, - help='Directory with test data') - -parser.add_argument( - '--reference-results', - metavar='REFERENCE_RESULTS_FILE', - dest='ref_respy', - default=os.path.join( - os.path.abspath( - os.getcwd()), - 'test/reference_results.py'), - required=False, - help='File with reference test results, for comparing against') - -parser.add_argument( - '--verbose', - action='store_true', - dest='verbose', - help='Verbose mode on') - -test_subdirs = ['unit_tests', 'sofa'] - -if __name__ == '__main__': - # parse cmd - args = parser.parse_args() - -# verbose print - verboseprint = print if args.verbose else lambda *a, **k: None - -# run tests recursively in each-subdir - for sdir in test_subdirs: - path = os.path.join(args.progs_dir, sdir) - if not os.path.isdir(path): - print('ERROR Expected to find dir {:} but couldn\'t!'.format(path), file=sys.stderr) - sys.exit(1) - for file in os.listdir(path): - if file.endswith('.out'): - exe = os.path.join(path, file) - verboseprint('Running command: {:}'.format([exe])) -# assert a 0 exit code - subprocess.run([exe], stdout=sys.stderr, check=True) - print('Test {:} OK!'.format(exe)) - elif file.endswith('.json'): - with open(os.path.join(path, file), 'r') as jin: data = json.load(jin) - for prog, dct in data.items(): - exe = '{:}'.format(dct['cxx']) - cmdargs = ['{:}'.format(dct['flags']), '{:}'.format(dct['name']), '-I{:}'.format(dct['incp']), ] - verboseprint('Running command {:}'.format(' '.join([exe]+cmdargs))) - result = subprocess.run([exe] + cmdargs, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT, check=False) - if result.returncode != int(dct['exit']): - print('ERROR Expected a return code {:} and got {:}; exe {:}'.format( - dct['exit'], result.returncode, prog), file=sys.stderr) - sys.exit(2) - else: - print('Test {:} OK!'.format(prog)) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..26c46e2 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,32 @@ +add_library(datetime) + +target_sources(datetime + PRIVATE + dat.cpp + datetime_io_core.cpp + modified_julian_day.cpp + month.cpp + strmonth.cpp + tpdateutc.cpp + twopartdates.cpp + utc2tai.cpp + ydoy_date.cpp + ymd_date.cpp +) + +target_include_directories(datetime + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../include +) + +# Install headers at: $PREFIX/datetime/... +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../include/ + DESTINATION include/datetime +) + +# install library +install(TARGETS datetime + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) diff --git a/src/datetime_io_core.cpp b/src/datetime_io_core.cpp index a65222a..d453e9a 100644 --- a/src/datetime_io_core.cpp +++ b/src/datetime_io_core.cpp @@ -5,7 +5,8 @@ inline const char *skipws(const char *line) noexcept { const char *c = line; - while (*c && (*c == ' ' || *c == '/' || *c == '-' || *c == 'T' || *c == ':' || *c == '_')) + while (*c && (*c == ' ' || *c == '/' || *c == '-' || *c == 'T' || *c == ':' || + *c == '_')) ++c; return c; } diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt new file mode 100644 index 0000000..e8d3cf3 --- /dev/null +++ b/test/unit_tests/CMakeLists.txt @@ -0,0 +1,162 @@ + +add_executable(test_datetime datetime.cpp) +target_link_libraries(test_datetime PRIVATE datetime) +add_test(NAME test_datetime COMMAND test_datetime) + +add_executable(datetime_addition datetime_addition.cpp) +target_link_libraries(datetime_addition PRIVATE datetime) +add_test(NAME datetime_addition COMMAND datetime_addition) + +add_executable(datetime_addition_sec datetime_addition_sec.cpp) +target_link_libraries(datetime_addition_sec PRIVATE datetime) +add_test(NAME datetime_addition_sec COMMAND datetime_addition_sec) + +add_executable(datetime_addition_sec2 datetime_addition_sec2.cpp) +target_link_libraries(datetime_addition_sec2 PRIVATE datetime) +add_test(NAME datetime_addition_sec2 COMMAND datetime_addition_sec2) + +add_executable(datetime_diff datetime_diff.cpp) +target_link_libraries(datetime_diff PRIVATE datetime) +add_test(NAME datetime_diff COMMAND datetime_diff) + +add_executable(dom dom.cpp) +target_link_libraries(dom PRIVATE datetime) +add_test(NAME dom COMMAND dom) + +add_executable(doy doy.cpp) +target_link_libraries(doy PRIVATE datetime) +add_test(NAME doy COMMAND doy) + +add_executable(dwrite dwrite.cpp) +target_link_libraries(dwrite PRIVATE datetime) +add_test(NAME dwrite COMMAND dwrite) + +add_executable(dwrite2 dwrite2.cpp) +target_link_libraries(dwrite2 PRIVATE datetime) +add_test(NAME dwrite2 COMMAND dwrite2) + +add_executable(dwrite3 dwrite3.cpp) +target_link_libraries(dwrite3 PRIVATE datetime) +add_test(NAME dwrite3 COMMAND dwrite3) + +add_executable(dwrite4 dwrite4.cpp) +target_link_libraries(dwrite4 PRIVATE datetime) +add_test(NAME dwrite4 COMMAND dwrite4) + +add_executable(dwrite5 dwrite5.cpp) +target_link_libraries(dwrite5 PRIVATE datetime) +add_test(NAME dwrite5 COMMAND dwrite5) + +add_executable(dwrite6 dwrite6.cpp) +target_link_libraries(dwrite6 PRIVATE datetime) +add_test(NAME dwrite6 COMMAND dwrite6) + +add_executable(dwrite7 dwrite7.cpp) +target_link_libraries(dwrite7 PRIVATE datetime) +add_test(NAME dwrite7 COMMAND dwrite7) + +add_executable(dwrite8 dwrite8.cpp) +target_link_libraries(dwrite8 PRIVATE datetime) +add_test(NAME dwrite8 COMMAND dwrite8) + +add_executable(dwrite9 dwrite9.cpp) +target_link_libraries(dwrite9 PRIVATE datetime) +add_test(NAME dwrite9 COMMAND dwrite9) + +#add_executable(hour_mock_1 hour_mock_1.cpp) +#target_link_libraries(hour_mock_1 PRIVATE datetime) +#add_test(NAME hour_mock_1 COMMAND hour_mock_1) +# +#add_executable(hour_mock_2 hour_mock_2.cpp) +#target_link_libraries(hour_mock_2 PRIVATE datetime) +#add_test(NAME hour_mock_2 COMMAND hour_mock_2) +# +#add_executable(hour_mock_3 hour_mock_3.cpp) +#target_link_libraries(hour_mock_3 PRIVATE datetime) +#add_test(NAME hour_mock_3 COMMAND hour_mock_3) + +add_executable(hours hours.cpp) +target_link_libraries(hours PRIVATE datetime) +add_test(NAME hours COMMAND hours) + +add_executable(interval interval.cpp) +target_link_libraries(interval PRIVATE datetime) +add_test(NAME interval COMMAND interval) + +add_executable(mjd mjd.cpp) +target_link_libraries(mjd PRIVATE datetime) +add_test(NAME mjd COMMAND mjd) + +add_executable(month month.cpp) +target_link_libraries(month PRIVATE datetime) +add_test(NAME month COMMAND month) + +add_executable(tpdates1 tpdates1.cpp) +target_link_libraries(tpdates1 PRIVATE datetime) +add_test(NAME tpdates1 COMMAND tpdates1) + +add_executable(tpdates2 tpdates2.cpp) +target_link_libraries(tpdates2 PRIVATE datetime) +add_test(NAME tpdates2 COMMAND tpdates2) + +add_executable(tpdates3 tpdates3.cpp) +target_link_libraries(tpdates3 PRIVATE datetime) +add_test(NAME tpdates3 COMMAND tpdates3) + +add_executable(tpdates4 tpdates4.cpp) +target_link_libraries(tpdates4 PRIVATE datetime) +add_test(NAME tpdates4 COMMAND tpdates4) + +add_executable(ydoy_date ydoy_date.cpp) +target_link_libraries(ydoy_date PRIVATE datetime) +add_test(NAME ydoy_date COMMAND ydoy_date) + +add_executable(year year.cpp) +target_link_libraries(year PRIVATE datetime) +add_test(NAME year COMMAND year) + +add_executable(ymd_date ymd_date.cpp) +target_link_libraries(ymd_date PRIVATE datetime) +add_test(NAME ymd_date COMMAND ymd_date) + +add_executable(dread21 dread21.cpp) +target_link_libraries(dread21 PRIVATE datetime) +add_test(NAME dread21 COMMAND dread21) + +add_executable(dread2 dread2.cpp) +target_link_libraries(dread2 PRIVATE datetime) +add_test(NAME dread2 COMMAND dread2) + +add_executable(dread3 dread3.cpp) +target_link_libraries(dread3 PRIVATE datetime) +add_test(NAME dread3 COMMAND dread3) + +add_executable(leapday leapday.cpp) +target_link_libraries(leapday PRIVATE datetime) +add_test(NAME leapday COMMAND leapday) + +add_executable(tpdate_add tpdate_add.cpp) +target_link_libraries(tpdate_add PRIVATE datetime) +add_test(NAME tpdate_add COMMAND tpdate_add) + +#add_executable(year_mock_1 year_mock_1.cpp) +#set_target_properties(year_mock_1 PROPERTIES +# EXCLUDE_FROM_ALL TRUE +# EXCLUDE_FROM_DEFAULT_BUILD TRUE) +#target_compile_definitions(year_mock_1 PRIVATE SHOULD_FAIL_TEST_001) +#target_link_libraries(year_mock_1 PRIVATE datetime) +#add_test(NAME year_mock_1 +# COMMAND ${CMAKE_COMMAND} --build . --target year_mock_1 --config $ +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +# Expect these tests to fail (i.e. cmake --build should return +# a non-zero value) +#set_tests_properties(year_mock_1 PROPERTIES WILL_FAIL TRUE) +# +#add_executable(year_mock_2 year_mock_2.cpp) +#target_link_libraries(year_mock_2 PRIVATE datetime) +#add_test(NAME year_mock_2 COMMAND year_mock_2) +# +#add_executable(year_mock_3 year_mock_3.cpp) +#target_link_libraries(year_mock_3 PRIVATE datetime) +#add_test(NAME year_mock_3 COMMAND year_mock_3) + diff --git a/test/unit_tests/datetime.cpp b/test/unit_tests/datetime.cpp index f37e0e5..796719e 100644 --- a/test/unit_tests/datetime.cpp +++ b/test/unit_tests/datetime.cpp @@ -22,6 +22,7 @@ int main() { const int iy = ydstr(gen); const int im = mdstr(gen); const int id = ddstr(gen); + /* do we have a valid date ? */ ymd_date ymd{year(iy), month(im), day_of_month(id)}; if (ymd.is_valid()) { @@ -43,7 +44,9 @@ int main() { dt += datetime_interval(0, nsec(1 * TOSEC)); /* reached one nsec before end of day */ } + assert(dt.imjd() == d.imjd()); + /* add onw more nsec; we are now on next day */ dt += datetime_interval(0, nsec(1)); assert(dt.imjd() == d.imjd() + modified_julian_day(1)); @@ -55,6 +58,7 @@ int main() { dt += datetime_interval(0, nsec(11 + 2 * 86400 * TOSEC)); assert(dt.imjd() == d.imjd() + modified_julian_day(2)); assert(dt.sec() == nsec(11)); + /* or do it this way ... */ auto dt2 = d; dt2 += datetime_interval(2, nsec(11)); @@ -65,14 +69,13 @@ int main() { dt += datetime_interval(0, nsec(-(11 + 2 * 86400 * TOSEC))); assert(dt.imjd() == d.imjd() - modified_julian_day(3)); assert(dt.sec() == nsec(nsec::max_in_day - 11)); + /* or do it this way ... */ dt2 = d; dt2 += datetime_interval(-2, nsec(11)); assert(dt == dt2); ++testnr; - if (testnr % 10) - printf("%d/%ld\r", testnr, num_tests); } } diff --git a/test/unit_tests/datetime_addition.cpp b/test/unit_tests/datetime_addition.cpp index 091b44e..c7fc8f3 100644 --- a/test/unit_tests/datetime_addition.cpp +++ b/test/unit_tests/datetime_addition.cpp @@ -2,6 +2,11 @@ #include #include +/* test datetime_interval + * create random dates (e.g. d1 and d2) and check if their interval behaves + * as expected (e.g. d=d2-d1; d1+d==d2) + */ + using namespace dso; constexpr const long num_tests = 1'000'000; @@ -23,26 +28,31 @@ int main() { while (testnr < num_tests) { /* do we have a valid date ? */ try { + /* random date d1 */ d1 = datetime{year(ydstr(gen)), month(mdstr(gen)), day_of_month(ddstr(gen)), nsec(nsdstr(gen))}; + /* random date d2 */ d2 = datetime{year(ydstr(gen)), month(mdstr(gen)), day_of_month(ddstr(gen)), nsec(nsdstr(gen))}; /* d3 on same day as d2 */ d3 = datetime{d2.imjd(), nsec(nsdstr(gen))}; ok = 1; } catch (std::exception &) { + /* failed to create some date, no worries, retry */ ok = 0; } + + /* dates successefully created; keep on ... */ if (ok) { const auto interval = d2 - d1; auto d = d1 + interval; assert(d == d2); + const auto d32 = d3 - d2; d = d2 + d32; assert(d == d3); + ++testnr; - if (testnr % 10) - printf("%d/%ld\r", testnr, num_tests); } } diff --git a/test/unit_tests/datetime_addition_sec.cpp b/test/unit_tests/datetime_addition_sec.cpp index 6c2b3aa..4644d4e 100644 --- a/test/unit_tests/datetime_addition_sec.cpp +++ b/test/unit_tests/datetime_addition_sec.cpp @@ -21,8 +21,8 @@ int main() { int testnr = 0, ok; datetime d1, d2, d3; while (testnr < num_tests) { - /* do we have a valid date ? */ try { + /* random date */ d1 = datetime{year(ydstr(gen)), month(mdstr(gen)), day_of_month(ddstr(gen)), nsec(nsdstr(gen))}; /* one day next */ @@ -32,6 +32,7 @@ int main() { 1, nsec((86400L / 2) * nsec::sec_factor())); ok = 1; } catch (std::exception &) { + /* no worries, will retry */ ok = 0; } if (ok) { @@ -41,6 +42,7 @@ int main() { for (int i = 0; i < 86400; i++) dt.add_seconds(seconds(1)); assert(dt == d2); + for (int i = 0; i < 86400; i++) dt.add_seconds(seconds(-1)); assert(dt == d1); @@ -49,14 +51,13 @@ int main() { dt = d1; for (int i = 0; i < 86400 + 86400 / 2; i++) dt.add_seconds(seconds(1)); + assert(dt == d3); for (int i = 0; i < 86400 + 86400 / 2; i++) dt.add_seconds(seconds(-1)); assert(dt == d1); ++testnr; - if (testnr % 10) - printf("%d/%ld\r", testnr, num_tests); } } diff --git a/test/unit_tests/datetime_addition_sec2.cpp b/test/unit_tests/datetime_addition_sec2.cpp index 518f406..c1dfaf1 100644 --- a/test/unit_tests/datetime_addition_sec2.cpp +++ b/test/unit_tests/datetime_addition_sec2.cpp @@ -2,11 +2,13 @@ #include #include +/* test adding and subtracting seconds of different type */ + using namespace dso; constexpr const long num_tests = 5'000; -using nsec = dso::milliseconds; -typedef nsec::underlying_type SecIntType; +using msec = dso::milliseconds; +typedef msec::underlying_type SecIntType; int main() { /* Generators for random numbers ... */ @@ -16,32 +18,36 @@ int main() { std::uniform_int_distribution<> mdstr(1, 12); /* range for months */ std::uniform_int_distribution<> ddstr(1, 31); /* range for day of month */ std::uniform_int_distribution nsdstr( - 0, nsec::max_in_day); /* range for day of month */ + 0, msec::max_in_day); /* range for day of month */ int testnr = 0, ok; - datetime d1, d2, d3; + datetime d1, d2, d3; while (testnr < num_tests) { - /* do we have a valid date ? */ try { - d1 = datetime{year(ydstr(gen)), month(mdstr(gen)), - day_of_month(ddstr(gen)), nsec(nsdstr(gen))}; + /* random date d1 */ + d1 = datetime{year(ydstr(gen)), month(mdstr(gen)), + day_of_month(ddstr(gen)), msec(nsdstr(gen))}; /* one day next */ - d2 = d1 + datetime_interval(1, nsec(0)); + d2 = d1 + datetime_interval(1, msec(0)); /* one and a half day next */ - d3 = d1 + datetime_interval( - 1, nsec((86400L / 2) * nsec::sec_factor())); + d3 = d1 + datetime_interval( + 1, msec((86400L / 2) * msec::sec_factor())); ok = 1; } catch (std::exception &) { + /* failed to create some datetime; no worries, retry */ ok = 0; } + if (ok) { /* add nanoseconds to milliseconds */ auto dt = d1; for (int i = 0; i < 86400; i++) { + /* 1'000'123'456 is 1'000 milliseconds */ dt.add_seconds(nanoseconds(1'000'123'456)); } assert(dt == d2); + dt = d2; for (int i = 0; i < 86400; i++) { dt.add_seconds(nanoseconds(-1'000'123'456)); @@ -53,13 +59,12 @@ int main() { for (int i = 0; i < 86400 + 86400 / 2; i++) dt.add_seconds(nanoseconds(1'000'789'456)); assert(dt == d3); + for (int i = 0; i < 86400 + 86400 / 2; i++) dt.add_seconds(nanoseconds(-1'000'123'456)); assert(dt == d1); ++testnr; - if (testnr % 10) - printf("%d/%ld\r", testnr, num_tests); } } diff --git a/test/unit_tests/datetime_diff.cpp b/test/unit_tests/datetime_diff.cpp index 57c4223..a81e38a 100644 --- a/test/unit_tests/datetime_diff.cpp +++ b/test/unit_tests/datetime_diff.cpp @@ -37,6 +37,7 @@ int main() { } catch (std::exception &) { ok = 0; } + if (ok) { /* one day next */ d24 = d1 + datetime_interval(1, nsec(0)); @@ -97,30 +98,17 @@ int main() { const nsec isec = intrvl.unsigned_total_sec(); /* total nsec in interval */ const auto rndd = d1 + intrvl; - // printf("Interval: %d + %ld = %ld\n", days, secday.as_underlying_type(), - // (isec).as_underlying_type()); - // printf("Computed : [1]%.15f [2]%.15f\n", - // rndd.diff(d1), - // rndd.diff(d1)); - // printf("Expected : [1]%.15f [2]%.15f\n", - // to_fractional_days(isec) * intrvl.sign(), - // to_fractional_seconds(isec) * intrvl.sign()); - // printf("Differences: [1]:%.5e [2]:%.5e\n", - // rndd.diff(d1) - - // to_fractional_days(isec) * intrvl.sign(), - // rndd.diff(d1) - - // to_fractional_seconds(isec) * intrvl.sign()); + assert(std::abs(rndd.diff(d1) - to_fractional_days(isec) * intrvl.sign()) <= FDAY_PRECISION); + /* better than nsec precision */ assert(std::abs(rndd.diff(d1) - to_fractional_seconds(isec) * intrvl.sign()) < SEC_PRECISION); ++testnr; - if (testnr % 10) - printf("%d/%ld\r", testnr, num_tests); } } diff --git a/test/unit_tests/dread3.cpp b/test/unit_tests/dread3.cpp index 1f3edca..f9861f4 100644 --- a/test/unit_tests/dread3.cpp +++ b/test/unit_tests/dread3.cpp @@ -150,9 +150,6 @@ int main() { FractionalSeconds(0e0)); assert(fequal(d1, tai)); assert(equal_within_ulps(d1.seconds(), tai.seconds(), 1)); - - // printf("%d %.15f\n", tai.imjd(), tai.seconds()); - // printf("%d %.15f\n", d1.imjd(), d1.seconds()); } TwoPartDateUTC utc(modified_julian_day(d).as_underlying_type(), diff --git a/test/unit_tests/dwrite9.cpp b/test/unit_tests/dwrite9.cpp index 4631e80..2eede6e 100644 --- a/test/unit_tests/dwrite9.cpp +++ b/test/unit_tests/dwrite9.cpp @@ -37,13 +37,8 @@ int main() { sz = dso::SpitDate::numChars + dso::SpitTime::numChars + 1; assert(!std::strncmp(buffer, "2023/10/24 00:00:00.000000059", sz)); - // printf("--------------------------------------------------\n"); td1 = TwoPartDate(d1); to_char(td1, buffer); - // printf("Expected: 2023/10/24 00:00:00.000000059\n"); - // printf("Got: %.29s\n", buffer); - // printf("Fr. Day: %.15Lf\n", td1.sec_of_day()); - // printf("Fr. Day: %.15Lf\n", td1.sec_of_day()); assert(!std::strncmp(buffer, "2023/10/24 00:00:00.000000059", sz)); d1 = datetime(year(2023), month(10), day_of_month(24), diff --git a/test/unit_tests/leapday.cpp b/test/unit_tests/leapday.cpp index 5d4ce15..d5a5247 100644 --- a/test/unit_tests/leapday.cpp +++ b/test/unit_tests/leapday.cpp @@ -72,8 +72,6 @@ int main() { to_char(tai, buf1); to_char(utc, buf2); - // printf("[1]TAI: %s (%.15e)\n[1]UTC: %s(%.15e)\n", buf1, - // tai.sec_of_day(), buf2, utc.sec_of_day()); /* add one more seconds */ tai.add_seconds(FractionalSeconds(1e0)); @@ -85,7 +83,6 @@ int main() { to_char(tai, buf1); to_char(utc, buf2); - // printf("[2]TAI: %s\n[2]UTC: %s\n", buf1, buf2); /* Datetime differences */ auto tpd1 = tai - tai2359; @@ -108,7 +105,6 @@ int main() { tpd1 = utc24 - utc00; assert(tpd1.imjd() == 1); assert(tpd1.seconds() == 1e0); - // printf("Diff: %d + %.15e\n", tpd1.imjd(), tpd1.seconds()); } return 0; diff --git a/test/unit_tests/mjd.cpp b/test/unit_tests/mjd.cpp index 60f0da0..068507c 100644 --- a/test/unit_tests/mjd.cpp +++ b/test/unit_tests/mjd.cpp @@ -30,10 +30,7 @@ int main() { /* assert results */ assert(d1 == d2); } - if (i % 10) - printf("%ld/%ld\r", i, num_tests); } - printf("All tests ok!\n"); return 0; } diff --git a/test/unit_tests/tpdate_add.cpp b/test/unit_tests/tpdate_add.cpp index 63660a4..296803d 100644 --- a/test/unit_tests/tpdate_add.cpp +++ b/test/unit_tests/tpdate_add.cpp @@ -97,8 +97,6 @@ int main() { 2e-2); ++testnr; } - if (testnr % 10) - printf("%d/%ld\r", testnr, num_tests); } } diff --git a/test/unit_tests/tpdates1.cpp b/test/unit_tests/tpdates1.cpp index cb4e78e..7f52dec 100644 --- a/test/unit_tests/tpdates1.cpp +++ b/test/unit_tests/tpdates1.cpp @@ -61,8 +61,6 @@ int main() { PRECISION_NSEC); ++testnr; - if (testnr % 10) - printf("%d/%ld\r", testnr, num_tests); } } diff --git a/test/unit_tests/tpdates2.cpp b/test/unit_tests/tpdates2.cpp index e810166..0435a59 100644 --- a/test/unit_tests/tpdates2.cpp +++ b/test/unit_tests/tpdates2.cpp @@ -61,8 +61,6 @@ int main() { PRECISION_NSEC); ++testnr; - if (testnr % 10) - printf("%d/%ld\r", testnr, num_tests); } } diff --git a/test/unit_tests/tpdates3.cpp b/test/unit_tests/tpdates3.cpp index e38cbef..1b61f39 100644 --- a/test/unit_tests/tpdates3.cpp +++ b/test/unit_tests/tpdates3.cpp @@ -61,8 +61,6 @@ int main() { PRECISION_NSEC); ++testnr; - if (testnr % 10) - printf("%d/%ld\r", testnr, num_tests); } } diff --git a/test/unit_tests/tpdates4.cpp b/test/unit_tests/tpdates4.cpp index 989d95e..a6f0978 100644 --- a/test/unit_tests/tpdates4.cpp +++ b/test/unit_tests/tpdates4.cpp @@ -61,8 +61,6 @@ int main() { PRECISION_NSEC); ++testnr; - if (testnr % 10) - printf("%d/%ld\r", testnr, num_tests); } }