refactor: clean up load_test.cpp by removing unused dependencies and tests

- Removed unused Jieba test and associated includes from load_test.cpp.
- Simplified main function to focus on essential operations.
- Ensured consistent exit handling by returning EXIT_SUCCESS.
This commit is contained in:
Yanyi Wu 2025-05-02 23:41:53 +08:00
parent 9cd64a1694
commit c14131e3e2

View File

@ -6,8 +6,6 @@
#include "cppjieba/MixSegment.hpp" #include "cppjieba/MixSegment.hpp"
#include "cppjieba/KeywordExtractor.hpp" #include "cppjieba/KeywordExtractor.hpp"
#include "limonp/Colors.hpp" #include "limonp/Colors.hpp"
#include "cppjieba/Jieba.hpp"
#include "gtest/gtest.h"
#include "test_paths.h" #include "test_paths.h"
using namespace cppjieba; using namespace cppjieba;
@ -53,24 +51,8 @@ void Extract(size_t times = 400) {
ColorPrintln(GREEN, "Extract: [%.3lf seconds]time consumed.", double(endTime - beginTime)/CLOCKS_PER_SEC); ColorPrintln(GREEN, "Extract: [%.3lf seconds]time consumed.", double(endTime - beginTime)/CLOCKS_PER_SEC);
} }
TEST(LoadTest, Test1) {
Jieba jieba(DICT_DIR "/jieba.dict.utf8",
DICT_DIR "/hmm_model.utf8",
DICT_DIR "/user.dict.utf8",
DICT_DIR "/idf.utf8",
DICT_DIR "/stop_words.utf8");
vector<string> words;
string result;
jieba.Cut("他来到了网易杭研大厦", words);
result << words;
string expected = "[\"\", \"来到\", \"\", \"网易\", \"杭研\", \"大厦\"]";
ASSERT_EQ(expected, result);
}
int main(int argc, char ** argv) { int main(int argc, char ** argv) {
testing::InitGoogleTest(&argc, argv);
Cut(); Cut();
Extract(); Extract();
return RUN_ALL_TESTS(); return EXIT_SUCCESS;
} }