forked from cmu-db/bustub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcatalog_test.cpp
51 lines (41 loc) · 1.38 KB
/
catalog_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//===----------------------------------------------------------------------===//
//
// BusTub
//
// catalog_test.cpp
//
// Identification: test/catalog/catalog_test.cpp
//
// Copyright (c) 2015-2019, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#include <string>
#include <unordered_set>
#include <vector>
#include "buffer/buffer_pool_manager.h"
#include "catalog/catalog.h"
#include "gtest/gtest.h"
#include "type/value_factory.h"
namespace bustub {
// NOLINTNEXTLINE
TEST(CatalogTest, DISABLED_CreateTableTest) {
auto disk_manager = new DiskManager("catalog_test.db");
auto bpm = new BufferPoolManager(32, disk_manager);
auto catalog = new Catalog(bpm, nullptr, nullptr);
std::string table_name = "potato";
// The table shouldn't exist in the catalog yet.
EXPECT_THROW(catalog->GetTable(table_name), std::out_of_range);
// Put the table into the catalog.
std::vector<Column> columns;
columns.emplace_back("A", TypeId::INTEGER);
columns.emplace_back("B", TypeId::BOOLEAN);
Schema schema(columns);
auto *table_metadata = catalog->CreateTable(nullptr, table_name, schema);
(void)table_metadata;
// Notice that this test case doesn't check anything! :(
// It is up to you to extend it
delete catalog;
delete bpm;
delete disk_manager;
}
} // namespace bustub