1
/* -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Brian Aker
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>
25
#include <drizzled/identifier.h>
27
using namespace drizzled;
29
TEST(table_identifier_test_standard, Create)
31
TableIdentifier identifier("test", "a");
32
EXPECT_EQ("test/a", identifier.getPath());
33
EXPECT_EQ("test.a", identifier.getSQLPath());
36
TEST(table_identifier_test_temporary, Create)
38
TableIdentifier identifier("test", "a", message::Table::TEMPORARY);
39
EXPECT_EQ("/#sql", identifier.getPath().substr(0, 5));
40
EXPECT_EQ("test.#a", identifier.getSQLPath());
43
TEST(table_identifier_test_internal, Create)
45
TableIdentifier identifier("test", "a", message::Table::TEMPORARY);
46
EXPECT_EQ("/#sql", identifier.getPath().substr(0, 5));
47
EXPECT_EQ("test.#a", identifier.getSQLPath());
50
TEST(table_identifier_test_build_tmptable_filename, Static)
52
std::vector<char> pathname;
54
TableIdentifier::build_tmptable_filename(pathname);
56
EXPECT_GT(pathname.size(), 0);
57
EXPECT_GT(strlen(&pathname[0]), 0);
60
TEST(table_identifier_test_key, Key)
62
TableIdentifier identifier("test", "a");
64
const TableIdentifier::Key key= identifier.getKey();
66
EXPECT_EQ(key.size(), 7);
67
EXPECT_EQ(key[0], 't');
68
EXPECT_EQ(key[1], 'e');
69
EXPECT_EQ(key[2], 's');
70
EXPECT_EQ(key[3], 't');
72
EXPECT_EQ(key[5], 'a');
76
TEST(table_identifier_test_key, KeyCompare)
78
TableIdentifier identifier("test", "a");
79
TableIdentifier identifier2("test", "a");
81
EXPECT_EQ((identifier.getKey() == identifier.getKey()), true);