31
31
#include <drizzled/plugin/listen.h>
33
33
using namespace drizzled;
35
35
class ItemStub : public Item
37
37
ItemStub(Session *fake_session) : Item(fake_session, this)
82
82
fake_client= plugin::Listen::getNullClient();
83
83
fake_session = new Session(fake_client);
84
fake_session->thread_stack= (char*) &fake_session;
85
fake_session->initGlobals();
84
86
item = ItemStub::get_item_stub(fake_session);
86
88
string_to_return.alloc(100);//TODO: some reasonable size here
102
104
ASSERT_EQ(210, interval.get_day());
b'\\ No newline at end of file'
107
TEST_F(TemporalIntervalTest, initFromItem_intervalDayMicrosecond)
109
char string[] = "7 12:45:19.777";
110
item->string_to_return->set_ascii(string, strlen(string));
112
interval.initFromItem(item.get(), INTERVAL_DAY_MICROSECOND, &buffer);
114
EXPECT_EQ(7, interval.get_day());
115
EXPECT_EQ(12, interval.get_hour());
116
EXPECT_EQ(45, interval.get_minute());
117
EXPECT_EQ(19, interval.get_second());
118
EXPECT_EQ(777000, interval.get_second_part());
121
TEST_F(TemporalIntervalTest, initFromItem_intervalDayMicrosecond_tooFewArguments_shouldLeaveHighEndItems)
123
char string[] = "45:19.777";
124
item->string_to_return->set_ascii(string, strlen(string));
126
interval.initFromItem(item.get(), INTERVAL_DAY_MICROSECOND, &buffer);
128
EXPECT_EQ(0, interval.get_day());
129
EXPECT_EQ(0, interval.get_hour());
130
EXPECT_EQ(45, interval.get_minute());
131
EXPECT_EQ(19, interval.get_second());
132
EXPECT_EQ(777000, interval.get_second_part());