forked from oceanbase/oceanbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_insert_up.cpp
More file actions
61 lines (58 loc) · 1.94 KB
/
Copy pathtest_insert_up.cpp
File metadata and controls
61 lines (58 loc) · 1.94 KB
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
52
53
54
55
56
57
58
59
60
61
/**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#include <gtest/gtest.h>
#include "sql/engine/dml/ob_table_insert_up.h"
#include "sql/engine/dml/ob_table_update.h"
#include "sql/engine/dml/ob_table_replace.h"
using namespace oceanbase::common;
namespace oceanbase
{
namespace sql
{
class TestInsertUp : public ::testing::Test
{
public:
TestInsertUp() {}
virtual ~TestInsertUp() {}
virtual void SetUp() {}
virtual void TearDown() {}
};
TEST_F(TestInsertUp, test_reset)
{
ObArenaAllocator alloc;
ObTableInsertUp insert_up(alloc);
const int64_t COUNT=5;
EXPECT_EQ(OB_SUCCESS, insert_up.init_scan_column_id_array(COUNT));
EXPECT_EQ(OB_SUCCESS, insert_up.init_update_related_column_array(COUNT));
EXPECT_EQ(OB_SUCCESS, insert_up.init_column_ids_count(COUNT));
EXPECT_EQ(OB_SUCCESS, insert_up.init_column_infos_count(COUNT));
insert_up.reset();
insert_up.reuse();
ObTableUpdate update(alloc);
EXPECT_EQ(OB_SUCCESS, update.init_updated_column_count(alloc, COUNT));
EXPECT_EQ(OB_SUCCESS, update.init_column_ids_count(COUNT));
EXPECT_EQ(OB_SUCCESS, update.init_column_infos_count(COUNT));
update.reset();
update.reuse();
ObTableReplace replace(alloc);
EXPECT_EQ(OB_SUCCESS, replace.init_column_ids_count(COUNT));
EXPECT_EQ(OB_SUCCESS, replace.init_column_infos_count(COUNT));
replace.reset();
replace.reuse();
}
} //namespace sql
} //namespace oceanbase
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}