101 lines
2.6 KiB
C++
101 lines
2.6 KiB
C++
//
|
|
// Created by dongl on 23-5-4.
|
|
//
|
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
|
#include "works/db/po/PoJson.h"
|
|
#include "works/db/UserFriendsDB.h"
|
|
#include "works/db/UserDB.h"
|
|
#include "smtp/send_email.h"
|
|
|
|
int main(int argc, char **argv) {
|
|
testing::InitGoogleTest(&argc, argv);
|
|
return RUN_ALL_TESTS();
|
|
}
|
|
|
|
TEST(JSON, MYSQL_TYPE_JSON) {
|
|
auto i = new PoJsonFriends();
|
|
std::string str = i->append(2725096176, 1, 100344, 1)->
|
|
append(783556037, 1, 1024255, 2)->to_string();
|
|
|
|
printf("%s", str.c_str());
|
|
}
|
|
|
|
|
|
TEST(add_friends, add_friends__Test) {
|
|
auto i = UserFriendsDB();
|
|
i.add_friends(2725096176, 783556037);
|
|
i.add_friends(783556037, 2725096176);
|
|
}
|
|
|
|
|
|
TEST(UserDB, UserDB_Ues_Test) {
|
|
auto i = UserDB();
|
|
i.test(2222222);
|
|
}
|
|
|
|
TEST(select_friends, select_friends_Test) {
|
|
auto i = UserFriendsDB();
|
|
i.select_friends_info(2725096176, 783556037);
|
|
}
|
|
|
|
TEST(select_friends_all, select_friends_Test) {
|
|
auto i = UserFriendsDB();
|
|
auto doc = i.select_friends_all(2725096176);
|
|
if (doc.has_value())
|
|
for (auto member = doc.value().MemberBegin(); member != doc.value().MemberEnd(); ++member) {
|
|
auto belong_grouping = member->value.GetObject().FindMember("belong_grouping");
|
|
auto add_time = member->value.GetObject().FindMember("add_time");
|
|
auto add_source = member->value.GetObject().FindMember("add_source");
|
|
printf("%s - %s:%d, %s:%d, %s:%d ", member->name.GetString(),
|
|
belong_grouping->name.GetString(), belong_grouping->value.GetInt(),
|
|
add_time->name.GetString(), add_time->value.GetInt(),
|
|
add_source->name.GetString(), add_source->value.GetInt());
|
|
}
|
|
}
|
|
|
|
TEST(fetch_account, fetch_account__Test) {
|
|
auto i = new UserDB();
|
|
if (i->fetch_account().has_value())
|
|
printf("%zu", i->fetch_account());
|
|
else
|
|
printf("号码池空");
|
|
}
|
|
|
|
TEST(bind_account_email, bind_account__Test) {
|
|
auto i = new UserDB();
|
|
printf("%d", i->bind_email(2725096176, "dongl@tholen.cn"));
|
|
}
|
|
|
|
TEST(bind_account_phone, bind_account__Test) {
|
|
auto i = new UserDB();
|
|
printf("%d", i->bind_phone(2725096176, "18900000000"));
|
|
}
|
|
|
|
|
|
TEST(UserDB_select_user, UserDB_Ues_Test) {
|
|
auto i = UserDB();
|
|
auto [state, po] = i.select_user(2725096176, "account");
|
|
if (state)
|
|
printf("%lu", po.account);
|
|
}
|
|
|
|
|
|
|
|
// "smtp.163.com",
|
|
// "bxhuu1o1vvyviiij6w@163.com",
|
|
// "IWXVJLUPMVFCFOBX",
|
|
// "2725096176@qq.com",
|
|
// "这是你的IM验证码",
|
|
|
|
//"<center>\n"
|
|
// "<h2 style=\"background-color: #CCFFCC\"> 验证码: XP02EE </h2>\n"
|
|
//"</center>"
|
|
|
|
|
|
TEST(email_send, email_send__Test) {
|
|
send_email_def("2725096176@qq.com", "AAKXT4");
|
|
}
|