~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to unittests/table_identifier.cc

  • Committer: Brian Aker
  • Date: 2010-07-15 23:18:11 UTC
  • mto: This revision was merged to the branch mainline in revision 1661.
  • Revision ID: brian@gaz-20100715231811-c5erivy1nvwf6bii
Merge in move identifier work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include <gtest/gtest.h>
24
24
 
25
 
#include <drizzled/identifier.h>
 
25
#include <drizzled/table_identifier.h>
26
26
 
27
27
using namespace drizzled;
28
28
 
30
30
{
31
31
  TableIdentifier identifier("test", "a");
32
32
  EXPECT_EQ("test/a", identifier.getPath());
33
 
  std::string path;
34
 
  identifier.getSQLPath(path);
35
 
  EXPECT_EQ("test.a", path);
 
33
  EXPECT_EQ("test.a", identifier.getSQLPath());
36
34
}
37
35
 
38
36
TEST(table_identifier_test_temporary, Create)
39
37
{
40
38
  TableIdentifier identifier("test", "a", message::Table::TEMPORARY);
41
39
  EXPECT_EQ("/#sql", identifier.getPath().substr(0, 5));
42
 
  std::string path;
43
 
  identifier.getSQLPath(path);
44
 
  EXPECT_EQ("test.#a", path);
 
40
  EXPECT_EQ("test.#a", identifier.getSQLPath());
45
41
}
46
42
 
47
43
TEST(table_identifier_test_internal, Create)
48
44
{
49
45
  TableIdentifier identifier("test", "a", message::Table::TEMPORARY);
50
46
  EXPECT_EQ("/#sql", identifier.getPath().substr(0, 5));
51
 
  std::string path;
52
 
  identifier.getSQLPath(path);
53
 
  EXPECT_EQ("test.#a", path);
 
47
  EXPECT_EQ("test.#a", identifier.getSQLPath());
54
48
}
55
49
 
56
50
TEST(table_identifier_test_build_tmptable_filename, Static)
70
64
  const TableIdentifier::Key key= identifier.getKey();
71
65
 
72
66
  EXPECT_EQ(key.size(), 7);
73
 
  EXPECT_EQ(key.vector()[0], 't');
74
 
  EXPECT_EQ(key.vector()[1], 'e');
75
 
  EXPECT_EQ(key.vector()[2], 's');
76
 
  EXPECT_EQ(key.vector()[3], 't');
77
 
  EXPECT_EQ(key.vector()[4], 0);
78
 
  EXPECT_EQ(key.vector()[5], 'a');
79
 
  EXPECT_EQ(key.vector()[6], 0);
 
67
  EXPECT_EQ(key[0], 't');
 
68
  EXPECT_EQ(key[1], 'e');
 
69
  EXPECT_EQ(key[2], 's');
 
70
  EXPECT_EQ(key[3], 't');
 
71
  EXPECT_EQ(key[4], 0);
 
72
  EXPECT_EQ(key[5], 'a');
 
73
  EXPECT_EQ(key[6], 0);
80
74
}
81
75
 
82
76
TEST(table_identifier_test_key, KeyCompare)