MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / main

Function main

tests/test-chat-template.cpp:112–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111
112int main(int argc, char ** argv) {
113 std::vector<std::string> args(argv, argv + argc);
114
115 std::string tmpl_path;
116 std::string json_path;
117 std::string output_path;
118 std::string & json_to_use = DEFAULT_JSON;
119 bool stop_on_first_fail = false;
120 bool use_common = true;
121
122 for (size_t i = 1; i < args.size(); i++) {
123 if (args[i] == "--help" || args[i] == "-h") {
124 std::cout << HELP << "\n";
125 return 0;
126 }
127 if (args[i] == "--json" && i + 1 < args.size()) {
128 json_path = args[i + 1];
129 i++;
130 } else if (args[i] == "--with-tools") {
131 json_to_use = DEFAULT_JSON_WITH_TOOLS;
132 } else if (args[i] == "--stop-on-first-fail") {
133 stop_on_first_fail = true;
134 } else if (args[i] == "--output" && i + 1 < args.size()) {
135 output_path = args[i + 1];
136 i++;
137 } else if (args[i] == "--no-common") {
138 use_common = true;
139 } else if (tmpl_path.empty()) {
140 tmpl_path = args[i];
141 } else {
142 std::cerr << "Unknown argument: " << args[i] << "\n";
143 std::cout << HELP << "\n";
144 return 1;
145 }
146 }
147
148 if (tmpl_path.empty()) {
149 return main_automated_tests();
150 }
151
152 json input_json;
153 if (!json_path.empty()) {
154 std::ifstream json_file(json_path);
155 if (!json_file) {
156 std::cerr << "Error: Could not open JSON file: " << json_path << "\n";
157 return 1;
158 }
159 std::string content = std::string(
160 std::istreambuf_iterator<char>(json_file),
161 std::istreambuf_iterator<char>());
162 input_json = json::parse(content);
163 } else {
164 input_json = json::parse(json_to_use);
165 }
166
167 std::filesystem::path p(tmpl_path);
168 if (std::filesystem::is_directory(p)) {
169 run_multiple(tmpl_path, stop_on_first_fail, input_json, use_common);

Callers

nothing calls this directly

Calls 6

main_automated_testsFunction · 0.85
stringClass · 0.85
run_multipleFunction · 0.85
run_singleFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected