1
/* -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Pawel Blokus
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
#include <gtest/gtest.h>
24
#include <drizzled/temporal.h>
26
#include "generator.h"
28
using namespace drizzled;
30
class DateTest : public ::testing::Test {
32
Date sample_date, identical_with_sample_date, before_sample_date, after_sample_date;
36
Generator::DateGen::make_date(&before_sample_date, 1980, 1, 1);
38
Generator::DateGen::make_date(&sample_date, 2010, 9, 8);
39
Generator::DateGen::make_date(&identical_with_sample_date, 2010, 9, 8);
41
Generator::DateGen::make_date(&after_sample_date, 2010, 9, 8);
46
TEST_F(DateTest, operatorEqual_ComparingIdencticalDates_ShouldReturn_True)
48
bool result= (sample_date == identical_with_sample_date);
50
ASSERT_EQ(true, result);
53
TEST_F(DateTest, operatorEqual_ComparingDifferentDates_ShouldReturn_False)
55
bool result= (sample_date == before_sample_date);
57
ASSERT_EQ(false, result);
60
TEST_F(DateTest, operatorNotEqual_ComparingIdencticalDates_ShouldReturn_False)
62
bool result= (sample_date != identical_with_sample_date);
64
ASSERT_EQ(false, result);
67
TEST_F(DateTest, operatorNotEqual_ComparingDifferentDates_ShouldReturn_True)
69
bool result= (sample_date != before_sample_date);
71
ASSERT_EQ(true, result);