/** * 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. */ #define USING_LOG_PREFIX RPC_TEST #include #include #include "lib/timezone/ob_time_convert.h" #include "rpc/obrpc/ob_rpc_packet.h" #include "rpc/obmysql/ob_mysql_util.h" using namespace oceanbase::common; using namespace oceanbase::obmysql; class TestObMySQLUtil : public ::testing::Test { public: TestObMySQLUtil() {} virtual void SetUp() { } virtual void TearDown() { } protected: }; #define PREPEND_ZEROS(char_size, offset, src_str, result_str) { \ memset(buf, 0, 1024); \ memcpy(buf, src_str, char_size); \ ObMySQLUtil::prepend_zeros(buf, char_size, offset); \ EXPECT_TRUE(0 == strcmp(buf, result_str)); \ } #define INT_CELL_STR(val, is_unsigned, obj_type, type, zerofill, zflength, ERR) { \ memset(buf, 0, 1024); \ pos = 0; \ of_result<<"value = "< '\n' ret = OB_SUCCESS; of_result << std::endl; of_result << "***********DATE_TEST***********"< it_result(if_result); std::ifstream if_expected(result_file); ASSERT_TRUE(if_expected.is_open()); std::istream_iterator it_expected(if_expected); ASSERT_TRUE(std::equal(it_result, std::istream_iterator(), it_expected)); std::remove(tmp_file); LOG_INFO("buf", K(ObString(buf))); } int main(int argc, char *argv[]) { system("rm -rf test_mysql_util.log"); OB_LOGGER.set_log_level("INFO"); OB_LOGGER.set_file_name("test_mysql_util.log", true); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }