43
43
virtual void SetUp()
45
TemporalGenerator::DateGen::make_date(&sample_date, 2010, 9, 8);
45
Generator::DateGen::make_date(&sample_date, 2010, 9, 8);
46
46
initBeforeIdenticalAfter();
50
50
template<> void DateTestCompareOperators<Date>::initBeforeIdenticalAfter()
52
TemporalGenerator::DateGen::make_date(&before_sample_date, 1980, 1, 1);
53
TemporalGenerator::DateGen::make_date(&identical_with_sample_date, 2010, 9, 8);
54
TemporalGenerator::DateGen::make_date(&after_sample_date, 2019, 5, 30);
52
Generator::DateGen::make_date(&before_sample_date, 1980, 1, 1);
53
Generator::DateGen::make_date(&identical_with_sample_date, 2010, 9, 8);
54
Generator::DateGen::make_date(&after_sample_date, 2019, 5, 30);
57
57
template<> void DateTestCompareOperators<DateTime>::initBeforeIdenticalAfter()
59
TemporalGenerator::DateTimeGen::make_datetime(&before_sample_date, 1990, 12, 31, 12, 12, 30);
60
TemporalGenerator::DateTimeGen::make_datetime(&identical_with_sample_date, 2010, 9, 8, 0, 0, 0);
61
TemporalGenerator::DateTimeGen::make_datetime(&after_sample_date, 2020, 4, 4, 4, 4, 4);
59
Generator::DateTimeGen::make_datetime(&before_sample_date, 1990, 12, 31, 12, 12, 30);
60
Generator::DateTimeGen::make_datetime(&identical_with_sample_date, 2010, 9, 8, 0, 0, 0);
61
Generator::DateTimeGen::make_datetime(&after_sample_date, 2020, 4, 4, 4, 4, 4);
64
64
template<> void DateTestCompareOperators<Timestamp>::initBeforeIdenticalAfter()
66
TemporalGenerator::TimestampGen::make_timestamp(&before_sample_date, 1980, 1, 1, 13, 56, 41);
67
TemporalGenerator::TimestampGen::make_timestamp(&identical_with_sample_date, 2010, 9, 8, 0, 0, 0);
68
TemporalGenerator::TimestampGen::make_timestamp(&after_sample_date, 2019, 5, 30, 9, 10, 13);
66
Generator::TimestampGen::make_timestamp(&before_sample_date, 1980, 1, 1, 13, 56, 41);
67
Generator::TimestampGen::make_timestamp(&identical_with_sample_date, 2010, 9, 8, 0, 0, 0);
68
Generator::TimestampGen::make_timestamp(&after_sample_date, 2019, 5, 30, 9, 10, 13);
71
71
typedef ::testing::Types<Date, DateTime, Timestamp> typesForDateTestCompareOperators;
462
462
TEST_F(DateTest, to_decimal)
464
464
drizzled::my_decimal to;
465
TemporalGenerator::DateGen::make_date(&date, 1987, 5, 6);
465
Generator::DateGen::make_date(&date, 1987, 5, 6);
467
467
date.to_decimal(&to);
469
469
ASSERT_EQ(19870506, to.buf[0]);
472
class DateFromStringTest: public ::testing::TestWithParam<const char*>
477
uint32_t years, months, days;
481
init_temporal_formats();
484
virtual void TearDown()
486
deinit_temporal_formats();
489
void assign_date_values()
492
months= date.months();
497
TEST_P(DateFromStringTest, from_string)
499
const char *valid_string= GetParam();
501
result= date.from_string(valid_string, strlen(valid_string));
504
assign_date_values();
506
EXPECT_EQ(2010, years);
507
EXPECT_EQ(6, months);
511
/* TODO:for some reason this was not declared by the macro, needs clarification*/
512
testing::internal::ParamGenerator<const char*> gtest_ValidStringDateFromStringTest_EvalGenerator_();
514
INSTANTIATE_TEST_CASE_P(ValidString, DateFromStringTest,
515
::testing::Values("20100607", /* YYYYMMDD */
516
"06/07/2010",/* MM[-/.]DD[-/.]YYYY (US common format)*/
517
"10.06.07",/* YY[-/.]MM[-/.]DD */
518
"10/6/7",/* YY[-/.][M]M[-/.][D]D */
519
"2010-6-7"/* YYYY[-/.][M]M[-/.][D]D */));
b'\\ No newline at end of file'