OmniSciDB  04ee39c94c
DateTimeUtilsTest.cpp File Reference
#include "../../Shared/DateConverters.h"
#include "Tests/TestHelpers.h"
#include <gtest/gtest.h>
+ Include dependency graph for DateTimeUtilsTest.cpp:

Go to the source code of this file.

Classes

struct  SampleDateEpochs
 

Namespaces

 anonymous_namespace{DateTimeUtilsTest.cpp}
 

Functions

template<class T >
void anonymous_namespace{DateTimeUtilsTest.cpp}::compare_epoch (const std::vector< T > &expected, const std::vector< T > &actual)
 
 TEST (DATE, EpochSecondsToDaysTest)
 
 TEST (DATE, EpochDaysToSecondsTest)
 
int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file DateTimeUtilsTest.cpp.

References logger::ERROR, TestHelpers::init_logger_stderr_only(), and LOG.

58  {
60  testing::InitGoogleTest(&argc, argv);
61 
62  int err{0};
63  try {
64  err = RUN_ALL_TESTS();
65  } catch (const std::exception& e) {
66  LOG(ERROR) << e.what();
67  }
68  return err;
69 }
#define LOG(tag)
Definition: Logger.h:182
void init_logger_stderr_only(int argc, char const *const *argv)
Definition: TestHelpers.h:194
+ Here is the call graph for this function:

◆ TEST() [1/2]

TEST ( DATE  ,
EpochSecondsToDaysTest   
)

Definition at line 40 of file DateTimeUtilsTest.cpp.

References anonymous_namespace{DateTimeUtilsTest.cpp}::compare_epoch(), and DateConverters::get_epoch_days_from_seconds().

40  {
41  const auto sample = SampleDateEpochs();
42  std::vector<int64_t> computed;
43  for (const auto ep : sample.epoch) {
44  computed.push_back(DateConverters::get_epoch_days_from_seconds(ep));
45  }
46  compare_epoch(computed, sample.actual_days);
47 }
void compare_epoch(const std::vector< T > &expected, const std::vector< T > &actual)
int64_t get_epoch_days_from_seconds(const int64_t seconds)
+ Here is the call graph for this function:

◆ TEST() [2/2]

TEST ( DATE  ,
EpochDaysToSecondsTest   
)

Definition at line 49 of file DateTimeUtilsTest.cpp.

References anonymous_namespace{DateTimeUtilsTest.cpp}::compare_epoch(), and DateConverters::get_epoch_seconds_from_days().

49  {
50  const auto sample = SampleDateEpochs();
51  std::vector<int64_t> computed;
52  for (const auto ep : sample.actual_days) {
53  computed.push_back(DateConverters::get_epoch_seconds_from_days(ep));
54  }
55  compare_epoch(computed, sample.expected_seconds);
56 }
void compare_epoch(const std::vector< T > &expected, const std::vector< T > &actual)
int64_t get_epoch_seconds_from_days(const int64_t days)
+ Here is the call graph for this function: