mirror of
https://github.com/HappyTanuki/BumbleCee.git
synced 2025-10-26 09:55:14 +00:00
테스트 구조 완성, 코딩 스타일 교정 기능 추가 쓸데없는 설정파일들 정리
This commit is contained in:
8
tests/CMakeLists.txt
Normal file
8
tests/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
file(GLOB_RECURSE TEST_SOURCES "*.cpp" "*.cxx" "*.cc")
|
||||
|
||||
foreach(test_src ${TEST_SOURCES})
|
||||
get_filename_component(test_name ${test_src} NAME_WE)
|
||||
add_executable(${test_name} ${test_src})
|
||||
target_link_libraries(${test_name} PRIVATE ${BOT_NAME}_lib)
|
||||
add_test(NAME ${test_name} COMMAND ${test_name})
|
||||
endforeach()
|
||||
52
tests/basic_yt_dlp_download.cc
Normal file
52
tests/basic_yt_dlp_download.cc
Normal file
@@ -0,0 +1,52 @@
|
||||
#include "precomp.h"
|
||||
#include "utils/console.h"
|
||||
#include "utils/update_checker.h"
|
||||
|
||||
int main() {
|
||||
boost::asio::io_context ctx;
|
||||
boost::system::error_code ec;
|
||||
|
||||
utils::CheckUpdate(ctx);
|
||||
|
||||
char buf[8192];
|
||||
#ifdef WIN32
|
||||
/*try {
|
||||
auto ytdlp_pipe = utils::OpenPipe(ctx,
|
||||
"yt-dlp.exe", { "-o", "-", "--quiet", "--ignore-errors", "-f",
|
||||
"bestaudio", "https://youtu.be/9_bTl2vvYQg?si=IVhvpDhnpPvziwQR" });
|
||||
|
||||
while (true) {
|
||||
boost::system::error_code read_ec;
|
||||
size_t bytes_read =
|
||||
boost::asio::read(ytdlp_pipe, boost::asio::buffer(buf,
|
||||
8192), read_ec); if (bytes_read > 0) { std::cout.write(buf, bytes_read);
|
||||
}
|
||||
if (read_ec == boost::asio::error::eof || read_ec) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const boost::process::system_error& e) {
|
||||
std::string error = e.what();
|
||||
return -1;
|
||||
}*/
|
||||
#else
|
||||
auto ytdlp_pipe = utils::OpenPipe(
|
||||
ctx, "yt-dlp",
|
||||
{"-o", "-", "--quiet", "--ignore-errors", "-f", "bestaudio",
|
||||
"https://youtu.be/9_bTl2vvYQg?si=IVhvpDhnpPvziwQR"});
|
||||
|
||||
while (true) {
|
||||
boost::system::error_code read_ec;
|
||||
size_t bytes_read =
|
||||
boost::asio::read(ytdlp_pipe, boost::asio::buffer(buf, 8192), read_ec);
|
||||
if (bytes_read > 0) {
|
||||
std::cout.write(buf, bytes_read);
|
||||
}
|
||||
if (read_ec == boost::asio::error::eof || read_ec) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
8
tests/update.cc
Normal file
8
tests/update.cc
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "precomp.h"
|
||||
#include "utils/update_checker.h"
|
||||
|
||||
int main() {
|
||||
boost::asio::io_context ctx;
|
||||
utils::CheckUpdate(ctx);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user