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 <drizzled/plugin/client.h>
24
#include <drizzled/drizzle_time.h>
25
#include <gtest/gtest.h>
28
#include "plugin_stubs.h"
30
using namespace drizzled;
32
class ClientTest : public ::testing::Test
40
memset(buffer, '\0', sizeof(buffer));
41
client.set_store_ret_val(true);
42
client.set_last_call_char_ptr(buffer);
46
TEST_F(ClientTest, store_drizzle_time_datetime)
48
//TODO: is the sign intentionally ignored in the case of a datetime?
49
DRIZZLE_TIME dt= { 2010, 4, 5, 23, 45, 3, 777, true, DRIZZLE_TIMESTAMP_DATETIME};
50
char expected[]= "2010-04-05 23:45:03.000777";
54
ASSERT_STREQ(expected, buffer);
57
TEST_F(ClientTest, store_drizzle_time_date)
59
//TODO: is the sign intentionally ignored in the case of a date?
60
DRIZZLE_TIME dt= { 2010, 4, 5, 0, 0, 0, 0, true, DRIZZLE_TIMESTAMP_DATE};
61
char expected[]= "2010-04-05";
65
ASSERT_STREQ(expected, buffer);
68
TEST_F(ClientTest, store_drizzle_time_time)
70
DRIZZLE_TIME dt= { 2010, 4, 5, 23, 45, 3, 777, true, DRIZZLE_TIMESTAMP_TIME};
71
char expected[]= "-23:45:03.000777";
75
ASSERT_STREQ(expected, buffer);