Skip to content

Commit 24a225f

Browse files
committed
Add ollama test
1 parent c018acc commit 24a225f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/test_interpreter.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,4 +962,39 @@ TEST_SUITE("xassist"){
962962
std::remove("openai_api_key.txt");
963963
}
964964

965+
TEST_CASE("ollama"){
966+
xcpp::xassist assist;
967+
std::string line = "%%xassist ollama --set-url";
968+
std::string cell = "1234";
969+
970+
assist(line, cell);
971+
972+
std::ifstream infile("ollama_url.txt");
973+
std::string content;
974+
std::getline(infile, content);
975+
976+
REQUIRE(content == "1234");
977+
infile.close();
978+
979+
line = "%%xassist ollama --save-model";
980+
cell = "1234";
981+
982+
assist(line, cell);
983+
984+
std::ifstream infile_model("ollama_model.txt");
985+
std::string content_model;
986+
std::getline(infile_model, content_model);
987+
988+
REQUIRE(content_model == "1234");
989+
infile_model.close();
990+
991+
StreamRedirectRAII redirect(std::cerr);
992+
993+
assist("%%xassist openai", "hello");
994+
995+
REQUIRE(!redirect.getCaptured().empty());
996+
997+
std::remove("openai_api_key.txt");
998+
}
999+
9651000
}

0 commit comments

Comments
 (0)