MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
create_field-t.cc
1 /* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software Foundation,
14  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15 
16 // First include (the generated) my_config.h, to get correct platform defines,
17 // then gtest.h (before any other MySQL headers), to avoid min() macros etc ...
18 #include "my_config.h"
19 #include <gtest/gtest.h>
20 
21 #include "test_utils.h"
22 #include "mock_create_field.h"
23 
24 
25 namespace create_field_unittest {
26 
29 
30 class CreateFieldTest : public ::testing::Test
31 {
32 protected:
33  virtual void SetUp() { initializer.SetUp(); }
34  virtual void TearDown() { initializer.TearDown(); }
35 
36  Server_initializer initializer;
37 };
38 
39 
40 TEST_F(CreateFieldTest, init)
41 {
42  // To do: Add all possible precisions.
44 
45  Mock_create_field field_definition_none(MYSQL_TYPE_TIMESTAMP, NULL, NULL);
46  EXPECT_EQ(Field::NONE, field_definition_none.unireg_check);
47 
48  Mock_create_field field_definition_dn(MYSQL_TYPE_TIMESTAMP, now, NULL);
49  EXPECT_EQ(Field::TIMESTAMP_DN_FIELD, field_definition_dn.unireg_check);
50 
51  Mock_create_field field_definition_dnun(MYSQL_TYPE_TIMESTAMP, now, now);
52  EXPECT_EQ(Field::TIMESTAMP_DNUN_FIELD, field_definition_dnun.unireg_check);
53 
54  Mock_create_field field_definition_un(MYSQL_TYPE_TIMESTAMP, NULL, now);
55  EXPECT_EQ(Field::TIMESTAMP_UN_FIELD, field_definition_un.unireg_check);
56 }
57 
58 }