MCPcopy Create free account
hub / github.com/LagPixelLOL/ChatGPTCLIBot / test_split_text

Function test_split_text

main/interface/data/Document.cpp:212–224  ·  view source on GitHub ↗

* Test function for split_text, do not use this function in production. */

Source from the content-addressed store, hash-verified

210 * Test function for split_text, do not use this function in production.
211 */
212 [[maybe_unused]] void test_split_text() {
213 static const std::filesystem::path dir("documentQA");
214 std::string text = file::read_text_file(dir / "testdoc.txt");
215 std::vector<std::string> chunks = split_text(text, 50);
216 std::string to_write = "----------\n";
217 for (const std::string& chunk : chunks) {
218 to_write += chunk + "\n----------\n";
219 }
220 if (to_write.ends_with('\n')) {
221 to_write.erase(to_write.size() - 1);
222 }
223 file::write_text_file(to_write, dir / "test_result.txt");
224 }
225} // doc

Callers

nothing calls this directly

Calls 5

read_text_fileFunction · 0.85
split_textFunction · 0.85
write_text_fileFunction · 0.85
eraseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected