Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add gtest, fix string trim function crash #42

Merged
merged 7 commits into from
Nov 25, 2023

Conversation

lqxhub
Copy link
Collaborator

@lqxhub lqxhub commented Nov 17, 2023

修复 pstd::StringTrim 函数 可能出现的崩溃

@AlexStocks
Copy link
Collaborator

加上单测?

@lqxhub
Copy link
Collaborator Author

lqxhub commented Nov 17, 2023

加上单测?

GTest那套吗

AlexStocks
AlexStocks previously approved these changes Nov 17, 2023
@AlexStocks
Copy link
Collaborator

加上单测?

GTest那套吗

你看吧,能加就加,不能加就以后再说。

@lqxhub
Copy link
Collaborator Author

lqxhub commented Nov 17, 2023

加上单测?

GTest那套吗

你看吧,能加就加,不能加就以后再说。

我周末看一下, 好加的话 就加了

@lqxhub lqxhub changed the title fix string trim function crash add gtest, fix string trim function crash Nov 19, 2023
@lqxhub
Copy link
Collaborator Author

lqxhub commented Nov 19, 2023

加入 GTest 单测, 添加部分测试用例, 修复 stringTrim RandomInt 函数错误

现在单测还没有集成到 GitHub CI中, 下一步再集成到 GitHub CI中

AlexStocks
AlexStocks previously approved these changes Nov 20, 2023
panlei-coder
panlei-coder previously approved these changes Nov 20, 2023
@lqxhub lqxhub dismissed stale reviews from panlei-coder and AlexStocks via ab0476f November 20, 2023 11:26
AlexStocks
AlexStocks previously approved these changes Nov 20, 2023
}
return ori.substr(pos, rpos - pos + 1);
return std::move(ori.substr(begin, ori.size() - begin));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的std::move应该是不必要的吧,编译器会通过RVO来处理返回的值

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

编译器应该是可以自动优化的, 但是我之前问gpt, 跟我说了一堆东西, 我不放心 就把 move加上了, 等明天我再确认一下

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的std::move应该是不必要的吧,编译器会通过RVO来处理返回的值

编译器确实可以自动使用RVO优化, 没有必要move 👍👍

src/pstd/pstd_string.cc Outdated Show resolved Hide resolved
loveyacper
loveyacper previously approved these changes Nov 22, 2023
@AlexStocks
Copy link
Collaborator

macos CI 还是失败了

@lqxhub
Copy link
Collaborator Author

lqxhub commented Nov 22, 2023

macos CI 还是失败了

今天早上发现有冲突了, 在网页上解了没弄好, 又个文件没弄过来,等晚上回去弄一下

Centurybbx
Centurybbx previously approved these changes Nov 22, 2023
@lqxhub
Copy link
Collaborator Author

lqxhub commented Nov 22, 2023

还有问题, rocksdb中依赖了gtest, 项目引入的gtest冲突了, 原本以为改一下rocksdb的cmake能解决, 测试了一下, 那样只是没有编译rocksdb, 实际还是没有解决这个依赖冲突问题

@lqxhub lqxhub changed the title add gtest, fix string trim function crash feat: add gtest, fix string trim function crash Nov 23, 2023
@AlexStocks AlexStocks merged commit f09ca70 into OpenAtomFoundation:unstable Nov 25, 2023
3 of 4 checks passed
Centurybbx pushed a commit to Centurybbx/pikiwidb that referenced this pull request Nov 27, 2023
* fix string trim function crash

* add gtest

* add timestamp test,fix Random range error

* Optimized trim function,add TrimLeft and TrimRight

* fix StringTrimRight range error

* Resolve rocksdb and gtest dependency conflicts

* fix rocksdb and gtest dependency conflicts,Streamlined rocksdb compilation
@lqxhub lqxhub deleted the strings branch November 28, 2023 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☢️ Bug Something isn't working ✏️ Feature New feature or request 🧹 Updates This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants