@@ -45,8 +45,10 @@ struct TestEnvironment {
4545 QueryExecutor executor;
4646
4747 TestEnvironment ()
48- : disk_manager(" ./test_data" ), bpm(config::Config::DEFAULT_BUFFER_POOL_SIZE, disk_manager),
49- catalog (Catalog::create()), lock_manager(),
48+ : disk_manager(" ./test_data" ),
49+ bpm (config::Config::DEFAULT_BUFFER_POOL_SIZE, disk_manager),
50+ catalog(Catalog::create()),
51+ lock_manager(),
5052 txn_manager(lock_manager, *catalog, bpm, bpm.get_log_manager()),
5153 executor(*catalog, bpm, lock_manager, txn_manager) {
5254 disk_manager.create_dir_if_not_exists ();
@@ -73,7 +75,7 @@ void create_test_table(QueryExecutor& exec, const char* name, const char* schema
7375}
7476
7577class QueryExecutorTests : public ::testing::Test {
76- protected:
78+ protected:
7779 void SetUp () override {}
7880 void TearDown () override {}
7981};
@@ -156,17 +158,16 @@ TEST_F(QueryExecutorTests, InsertSingleRow) {
156158TEST_F (QueryExecutorTests, InsertMultipleRows) {
157159 TestEnvironment env;
158160 execute_sql (env.executor , " CREATE TABLE test_table (id INT, val INT)" );
159- const auto res = execute_sql (env. executor ,
160- " INSERT INTO test_table VALUES (1, 10), (2, 20), (3, 30)" );
161+ const auto res =
162+ execute_sql (env. executor , " INSERT INTO test_table VALUES (1, 10), (2, 20), (3, 30)" );
161163 EXPECT_TRUE (res.success ());
162164 EXPECT_EQ (res.rows_affected (), 3U );
163165}
164166
165167TEST_F (QueryExecutorTests, InsertWithColumnList) {
166168 TestEnvironment env;
167169 execute_sql (env.executor , " CREATE TABLE test_table (id INT, val INT, name TEXT)" );
168- const auto res = execute_sql (env.executor ,
169- " INSERT INTO test_table (id, val) VALUES (1, 100)" );
170+ const auto res = execute_sql (env.executor , " INSERT INTO test_table (id, val) VALUES (1, 100)" );
170171 EXPECT_TRUE (res.success ());
171172}
172173
@@ -268,8 +269,7 @@ TEST_F(QueryExecutorTests, SelectWithGroupBy) {
268269 TestEnvironment env;
269270 execute_sql (env.executor , " CREATE TABLE test_table (cat TEXT, val INT)" );
270271 execute_sql (env.executor , " INSERT INTO test_table VALUES ('A', 10), ('A', 20), ('B', 5)" );
271- const auto res = execute_sql (env.executor ,
272- " SELECT cat, SUM(val) FROM test_table GROUP BY cat" );
272+ const auto res = execute_sql (env.executor , " SELECT cat, SUM(val) FROM test_table GROUP BY cat" );
273273 EXPECT_TRUE (res.success ());
274274 EXPECT_EQ (res.row_count (), 2U );
275275}
@@ -298,8 +298,7 @@ TEST_F(QueryExecutorTests, UpdateWithCondition) {
298298 TestEnvironment env;
299299 execute_sql (env.executor , " CREATE TABLE test_table (id INT, val INT)" );
300300 execute_sql (env.executor , " INSERT INTO test_table VALUES (1, 10), (2, 20), (3, 30)" );
301- const auto res = execute_sql (env.executor ,
302- " UPDATE test_table SET val = 100 WHERE id = 2" );
301+ const auto res = execute_sql (env.executor , " UPDATE test_table SET val = 100 WHERE id = 2" );
303302 EXPECT_TRUE (res.success ());
304303 EXPECT_EQ (res.rows_affected (), 1U );
305304}
@@ -435,9 +434,9 @@ TEST_F(QueryExecutorTests, LeftJoin) {
435434 execute_sql (env.executor , " INSERT INTO table_a VALUES (1, 'Alice'), (2, 'Bob')" );
436435 execute_sql (env.executor , " INSERT INTO table_b VALUES (1, 100), (2, 200)" );
437436
438- const auto res = execute_sql (
439- env. executor ,
440- " SELECT table_a.name, table_b.val FROM table_a LEFT JOIN table_b ON table_a.id = table_b.id" );
437+ const auto res = execute_sql (env. executor ,
438+ " SELECT table_a.name, table_b.val FROM table_a LEFT JOIN table_b "
439+ " ON table_a.id = table_b.id" );
441440 EXPECT_TRUE (res.success ());
442441 EXPECT_EQ (res.row_count (), 2U );
443442}
0 commit comments