//this file is generated by program(drogon_ctl) automatically,don't modify it!
#include "test_main.h"
#include <drogon/utils/OStringStream.h>
#include <drogon/utils/Utilities.h>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <list>
#include <deque>
#include <queue>
using namespace drogon;
std::string test_main::genText(const DrTemplateData& test_main_view_data)
{
	drogon::OStringStream test_main_tmp_stream;
	std::string layoutName{""};
	test_main_tmp_stream << "#define DROGON_TEST_MAIN\n";
	test_main_tmp_stream << "#include <drogon/drogon_test.h>\n";
	test_main_tmp_stream << "#include <drogon/drogon.h>\n";
test_main_tmp_stream<<"\n";
	test_main_tmp_stream << "DROGON_TEST(BasicTest)\n";
	test_main_tmp_stream << "{\n";
	test_main_tmp_stream << "    // Add your tests here\n";
	test_main_tmp_stream << "}\n";
test_main_tmp_stream<<"\n";
	test_main_tmp_stream << "int main(int argc, char** argv) \n";
	test_main_tmp_stream << "{\n";
	test_main_tmp_stream << "    using namespace drogon;\n";
test_main_tmp_stream<<"\n";
	test_main_tmp_stream << "    std::promise<void> p1;\n";
	test_main_tmp_stream << "    std::future<void> f1 = p1.get_future();\n";
test_main_tmp_stream<<"\n";
	test_main_tmp_stream << "    // Start the main loop on another thread\n";
	test_main_tmp_stream << "    std::thread thr([&]() {\n";
	test_main_tmp_stream << "        // Queues the promise to be fulfilled after starting the loop\n";
	test_main_tmp_stream << "        app().getLoop()->queueInLoop([&p1]() { p1.set_value(); });\n";
	test_main_tmp_stream << "        app().run();\n";
	test_main_tmp_stream << "    });\n";
test_main_tmp_stream<<"\n";
	test_main_tmp_stream << "    // The future is only satisfied after the event loop started\n";
	test_main_tmp_stream << "    f1.get();\n";
	test_main_tmp_stream << "    int status = test::run(argc, argv);\n";
test_main_tmp_stream<<"\n";
	test_main_tmp_stream << "    // Ask the event loop to shutdown and wait\n";
	test_main_tmp_stream << "    app().getLoop()->queueInLoop([]() { app().quit(); });\n";
	test_main_tmp_stream << "    thr.join();\n";
	test_main_tmp_stream << "    return status;\n";
	test_main_tmp_stream << "}\n";
if(layoutName.empty())
{
std::string ret{std::move(test_main_tmp_stream.str())};
return ret;
}else
{
auto templ = DrTemplateBase::newTemplate(layoutName);
if(!templ) return "";
HttpViewData data = test_main_view_data;
auto str = std::move(test_main_tmp_stream.str());
if(!str.empty() && str[str.length()-1] == '\n') str.resize(str.length()-1);
data[""] = std::move(str);
return templ->genText(data);
}
}
