From 6136d37acc94186c3c9158f9137d654b60e6613b Mon Sep 17 00:00:00 2001 From: pk4wt2yal <1330800687@qq.com> Date: Mon, 25 Nov 2024 12:21:33 +0800 Subject: [PATCH] Delete 'src/my-online-judge-master/MYOJ/compile_server/test/testCompileRunServer.cc' --- .../test/testCompileRunServer.cc | 101 ------------------ 1 file changed, 101 deletions(-) delete mode 100644 src/my-online-judge-master/MYOJ/compile_server/test/testCompileRunServer.cc diff --git a/src/my-online-judge-master/MYOJ/compile_server/test/testCompileRunServer.cc b/src/my-online-judge-master/MYOJ/compile_server/test/testCompileRunServer.cc deleted file mode 100644 index eda63b3..0000000 --- a/src/my-online-judge-master/MYOJ/compile_server/test/testCompileRunServer.cc +++ /dev/null @@ -1,101 +0,0 @@ -#include -#include "comm/httplib.h" - -int main() -{ - httplib::Client cl("127.0.0.1", 8082); - - std::string compile_json; - - Json::Value value_in; - Json::StyledWriter writer; - - value_in["code"] = R"(#include -#include -#include -#include -#include - -using namespace std; - -class Solution -{ -public: - bool isPalindrome(int x) - { - if (x < 0) - { - return false; // 负数不可能是回文数 - } - - string str1 = to_string(x); - string str2(str1); - reverse(str2.begin(), str2.end()); - - for (int i = 0; i < str1.size() / 2; i++) - { - if (str2[i] != str1[i]) - { - return false; - } - } - - return true; - } -}; - -void Test1() -{ - // 通过定义临时对象,来完成方法的调用 - bool ret = Solution().isPalindrome(121); - if (ret) - { - std::cout << "通过用例1, 测试121通过 ... OK!" << std::endl; - } - else - { - std::cout << "没有通过用例1, 测试的值是: 121" << std::endl; - } -} - -void Test2() -{ - // 通过定义临时对象,来完成方法的调用 - bool ret = Solution().isPalindrome(-10); - if (!ret) - { - std::cout << "通过用例2, 测试-10通过 ... OK!" << std::endl; - } - else - { - std::cout << "没有通过用例2, 测试的值是: -10" << std::endl; - } -} - -int main() -{ - Test1(); - Test2(); - - return 0; -})"; - value_in["cpu_limit"] = 1; - value_in["mem_limit"] = 1024 * 1024 * 1024; - - compile_json = writer.write(value_in); - - httplib::Result res = cl.Post("/compile_and_run", compile_json, "application/json;charset=utf-8"); - - if (res && res->status == 200) - { - std::cout << "编译运行服务完成...\n" << std::endl; - std::cout << res->body << std::endl; - } - else - { - // 失败,需要重新请求,并且将此次选择的主机放到下线表中 - std::cout << "编译运行服务失败...\n" << std::endl; - } - - return 0; -}