feat(tests): rework tests in numerous ways (#3059)
This commit is contained in:
@@ -2,39 +2,24 @@
|
||||
* @file tests/unit/test_audio.cpp
|
||||
* @brief Test src/audio.*.
|
||||
*/
|
||||
#include <bitset>
|
||||
#include <src/audio.h>
|
||||
|
||||
#include <tests/conftest.cpp>
|
||||
#include "../tests_common.h"
|
||||
|
||||
using namespace audio;
|
||||
|
||||
class AudioTest: public virtual BaseTest, public PlatformInitBase, public ::testing::WithParamInterface<std::tuple<std::basic_string_view<char>, config_t>> {
|
||||
protected:
|
||||
struct AudioTest: PlatformTestSuite, testing::WithParamInterface<std::tuple<std::basic_string_view<char>, config_t>> {
|
||||
void
|
||||
SetUp() override {
|
||||
BaseTest::SetUp();
|
||||
PlatformInitBase::SetUp();
|
||||
|
||||
std::string_view p_name = std::get<0>(GetParam());
|
||||
std::cout << "AudioTest(" << p_name << "):: starting Fixture SetUp" << std::endl;
|
||||
|
||||
m_config = std::get<1>(GetParam());
|
||||
m_mail = std::make_shared<safe::mail_raw_t>();
|
||||
}
|
||||
|
||||
void
|
||||
TearDown() override {
|
||||
PlatformInitBase::TearDown();
|
||||
BaseTest::TearDown();
|
||||
}
|
||||
|
||||
protected:
|
||||
config_t m_config;
|
||||
safe::mail_t m_mail;
|
||||
};
|
||||
|
||||
static std::bitset<config_t::MAX_FLAGS>
|
||||
constexpr std::bitset<config_t::MAX_FLAGS>
|
||||
config_flags(int flag = -1) {
|
||||
std::bitset<3> result = std::bitset<config_t::MAX_FLAGS>();
|
||||
if (flag >= 0) {
|
||||
@@ -46,11 +31,12 @@ config_flags(int flag = -1) {
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Configurations,
|
||||
AudioTest,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
std::make_tuple("HIGH_STEREO", config_t { 5, 2, 0x3, { 0 }, config_flags(config_t::HIGH_QUALITY) }),
|
||||
std::make_tuple("SURROUND51", config_t { 5, 6, 0x3F, { 0 }, config_flags() }),
|
||||
std::make_tuple("SURROUND71", config_t { 5, 8, 0x63F, { 0 }, config_flags() }),
|
||||
std::make_tuple("SURROUND51_CUSTOM", config_t { 5, 6, 0x3F, { 6, 4, 2, { 0, 1, 4, 5, 2, 3 } }, config_flags(config_t::CUSTOM_SURROUND_PARAMS) })));
|
||||
std::make_tuple("SURROUND51_CUSTOM", config_t { 5, 6, 0x3F, { 6, 4, 2, { 0, 1, 4, 5, 2, 3 } }, config_flags(config_t::CUSTOM_SURROUND_PARAMS) })),
|
||||
[](const auto &info) { return std::string(std::get<0>(info.param)); });
|
||||
|
||||
TEST_P(AudioTest, TestEncode) {
|
||||
std::thread timer([&] {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
#include <src/file_handler.h>
|
||||
|
||||
#include <tests/conftest.cpp>
|
||||
#include "../tests_common.h"
|
||||
|
||||
class FileHandlerParentDirectoryTest: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
struct FileHandlerParentDirectoryTest: testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
|
||||
TEST_P(FileHandlerParentDirectoryTest, Run) {
|
||||
auto [input, expected] = GetParam();
|
||||
@@ -16,12 +16,12 @@ TEST_P(FileHandlerParentDirectoryTest, Run) {
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
FileHandlerTests,
|
||||
FileHandlerParentDirectoryTest,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
std::make_tuple("/path/to/file.txt", "/path/to"),
|
||||
std::make_tuple("/path/to/directory", "/path/to"),
|
||||
std::make_tuple("/path/to/directory/", "/path/to")));
|
||||
|
||||
class FileHandlerMakeDirectoryTest: public ::testing::TestWithParam<std::tuple<std::string, bool, bool>> {};
|
||||
struct FileHandlerMakeDirectoryTest: testing::TestWithParam<std::tuple<std::string, bool, bool>> {};
|
||||
|
||||
TEST_P(FileHandlerMakeDirectoryTest, Run) {
|
||||
auto [input, expected, remove] = GetParam();
|
||||
@@ -41,28 +41,18 @@ TEST_P(FileHandlerMakeDirectoryTest, Run) {
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
FileHandlerTests,
|
||||
FileHandlerMakeDirectoryTest,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
std::make_tuple("dir_123", true, false),
|
||||
std::make_tuple("dir_123", true, true),
|
||||
std::make_tuple("dir_123/abc", true, false),
|
||||
std::make_tuple("dir_123/abc", true, true)));
|
||||
|
||||
class FileHandlerTests: public virtual BaseTest, public ::testing::WithParamInterface<std::tuple<int, std::string>> {
|
||||
protected:
|
||||
void
|
||||
SetUp() override {
|
||||
BaseTest::SetUp();
|
||||
}
|
||||
struct FileHandlerTests: testing::TestWithParam<std::tuple<int, std::string>> {};
|
||||
|
||||
void
|
||||
TearDown() override {
|
||||
BaseTest::TearDown();
|
||||
}
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
TestFiles,
|
||||
FileHandlerTests,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
std::make_tuple(0, ""), // empty file
|
||||
std::make_tuple(1, "a"), // single character
|
||||
std::make_tuple(2, "Mr. Blue Sky - Electric Light Orchestra"), // single line
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
#include <src/httpcommon.h>
|
||||
|
||||
#include <tests/conftest.cpp>
|
||||
#include "../tests_common.h"
|
||||
|
||||
class UrlEscapeTest: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
struct UrlEscapeTest: testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
|
||||
TEST_P(UrlEscapeTest, Run) {
|
||||
auto [input, expected] = GetParam();
|
||||
@@ -16,12 +16,12 @@ TEST_P(UrlEscapeTest, Run) {
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
UrlEscapeTests,
|
||||
UrlEscapeTest,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
std::make_tuple("igdb_0123456789", "igdb_0123456789"),
|
||||
std::make_tuple("../../../", "..%2F..%2F..%2F"),
|
||||
std::make_tuple("..*\\", "..%2A%5C")));
|
||||
|
||||
class UrlGetHostTest: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
struct UrlGetHostTest: testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
|
||||
TEST_P(UrlGetHostTest, Run) {
|
||||
auto [input, expected] = GetParam();
|
||||
@@ -31,12 +31,12 @@ TEST_P(UrlGetHostTest, Run) {
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
UrlGetHostTests,
|
||||
UrlGetHostTest,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
std::make_tuple("https://images.igdb.com/example.txt", "images.igdb.com"),
|
||||
std::make_tuple("http://localhost:8080", "localhost"),
|
||||
std::make_tuple("nonsense!!}{::", "")));
|
||||
|
||||
class DownloadFileTest: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
struct DownloadFileTest: testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
|
||||
TEST_P(DownloadFileTest, Run) {
|
||||
auto [url, filename] = GetParam();
|
||||
@@ -48,6 +48,6 @@ TEST_P(DownloadFileTest, Run) {
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
DownloadFileTests,
|
||||
DownloadFileTest,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
std::make_tuple("https://httpbin.org/base64/aGVsbG8h", "hello.txt"),
|
||||
std::make_tuple("https://httpbin.org/redirect-to?url=/base64/aGVsbG8h", "hello-redirect.txt")));
|
||||
|
||||
@@ -2,74 +2,63 @@
|
||||
* @file tests/unit/test_logging.cpp
|
||||
* @brief Test src/logging.*.
|
||||
*/
|
||||
#include <fstream>
|
||||
|
||||
#include <src/logging.h>
|
||||
|
||||
#include <tests/conftest.cpp>
|
||||
#include "../tests_common.h"
|
||||
|
||||
class LoggerInitTest: public virtual BaseTest, public ::testing::WithParamInterface<int> {
|
||||
protected:
|
||||
void
|
||||
SetUp() override {
|
||||
BaseTest::SetUp();
|
||||
}
|
||||
#include <fstream>
|
||||
#include <random>
|
||||
|
||||
namespace {
|
||||
std::array log_levels = {
|
||||
std::tuple("verbose", &verbose),
|
||||
std::tuple("debug", &debug),
|
||||
std::tuple("info", &info),
|
||||
std::tuple("warning", &warning),
|
||||
std::tuple("error", &error),
|
||||
std::tuple("fatal", &fatal),
|
||||
};
|
||||
|
||||
constexpr auto log_file = "test_sunshine.log";
|
||||
} // namespace
|
||||
|
||||
struct LogLevelsTest: testing::TestWithParam<decltype(log_levels)::value_type> {};
|
||||
|
||||
void
|
||||
TearDown() override {
|
||||
BaseTest::TearDown();
|
||||
}
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
LogLevel,
|
||||
LoggerInitTest,
|
||||
::testing::Values(
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5));
|
||||
TEST_P(LoggerInitTest, InitLogging) {
|
||||
int logLevel = GetParam();
|
||||
std::string logFilePath = "test_log_" + std::to_string(logLevel) + ".log";
|
||||
Logging,
|
||||
LogLevelsTest,
|
||||
testing::ValuesIn(log_levels),
|
||||
[](const auto &info) { return std::string(std::get<0>(info.param)); });
|
||||
|
||||
// deinit the BaseTest logger
|
||||
BaseTest::deinit_guard.reset();
|
||||
TEST_P(LogLevelsTest, PutMessage) {
|
||||
auto [label, plogger] = GetParam();
|
||||
ASSERT_TRUE(plogger);
|
||||
auto &logger = *plogger;
|
||||
|
||||
auto log_deinit = logging::init(logLevel, logFilePath);
|
||||
if (!log_deinit) {
|
||||
FAIL() << "Failed to initialize logging";
|
||||
}
|
||||
}
|
||||
std::random_device rand_dev;
|
||||
std::mt19937_64 rand_gen(rand_dev());
|
||||
auto test_message = std::to_string(rand_gen()) + std::to_string(rand_gen());
|
||||
BOOST_LOG(logger) << test_message;
|
||||
|
||||
TEST(LogFlushTest, CheckLogFile) {
|
||||
// Write a log message
|
||||
BOOST_LOG(info) << "Test message";
|
||||
// Flush logger and search for the message in the log file
|
||||
|
||||
// Call log_flush
|
||||
logging::log_flush();
|
||||
|
||||
// Check the contents of the log file
|
||||
std::ifstream log_file("test.log");
|
||||
std::string line;
|
||||
std::ifstream input(log_file);
|
||||
ASSERT_TRUE(input.is_open());
|
||||
|
||||
bool found = false;
|
||||
while (std::getline(log_file, line)) {
|
||||
if (line.find("Test message") != std::string::npos) {
|
||||
found = true;
|
||||
break;
|
||||
for (std::string line; std::getline(input, line);) {
|
||||
if (line.find(test_message) != std::string::npos) {
|
||||
// Assume that logger may change the case of log level label
|
||||
std::transform(line.begin(), line.end(), line.begin(),
|
||||
[](char c) { return std::tolower(c); });
|
||||
|
||||
if (line.find(label) != std::string::npos) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_TRUE(found);
|
||||
}
|
||||
|
||||
TEST(PrintHelpTest, CheckOutput) {
|
||||
std::string name = "test";
|
||||
logging::print_help(name.c_str());
|
||||
|
||||
std::string output = cout_buffer.str();
|
||||
|
||||
EXPECT_NE(output.find("Usage: " + name), std::string::npos);
|
||||
EXPECT_NE(output.find("--help"), std::string::npos);
|
||||
ASSERT_TRUE(found);
|
||||
}
|
||||
|
||||
@@ -3,38 +3,33 @@
|
||||
* @brief Test src/input.*.
|
||||
*/
|
||||
#include <src/input.h>
|
||||
#include <src/platform/common.h>
|
||||
|
||||
#include <tests/conftest.cpp>
|
||||
#include "../tests_common.h"
|
||||
|
||||
class MouseHIDTest: public virtual BaseTest, public PlatformInitBase, public ::testing::WithParamInterface<util::point_t> {
|
||||
protected:
|
||||
struct MouseHIDTest: PlatformTestSuite, testing::WithParamInterface<util::point_t> {
|
||||
void
|
||||
SetUp() override {
|
||||
BaseTest::SetUp();
|
||||
PlatformInitBase::SetUp();
|
||||
#ifdef _WIN32
|
||||
// TODO: Windows tests are failing, `get_mouse_loc` seems broken and `platf::abs_mouse` too
|
||||
// the alternative `platf::abs_mouse` method seem to work better during tests,
|
||||
// but I'm not sure about real work
|
||||
GTEST_SKIP_("MouseTest:: skipped for now. TODO Windows");
|
||||
GTEST_SKIP() << "TODO Windows";
|
||||
#elif __linux__
|
||||
// TODO: Inputtino waiting https://github.com/games-on-whales/inputtino/issues/6 is resolved.
|
||||
GTEST_SKIP_("MouseTest:: skipped for now. TODO Inputtino");
|
||||
GTEST_SKIP() << "TODO Inputtino";
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
TearDown() override {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
PlatformInitBase::TearDown();
|
||||
BaseTest::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
MouseInputs,
|
||||
MouseHIDTest,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
util::point_t { 40, 40 },
|
||||
util::point_t { 70, 150 }));
|
||||
// todo: add tests for hitting screen edges
|
||||
@@ -42,30 +37,30 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
TEST_P(MouseHIDTest, MoveInputTest) {
|
||||
util::point_t mouse_delta = GetParam();
|
||||
|
||||
std::cout << "MoveInputTest:: got param: " << mouse_delta << std::endl;
|
||||
BOOST_LOG(tests) << "MoveInputTest:: got param: " << mouse_delta;
|
||||
platf::input_t input = platf::input();
|
||||
std::cout << "MoveInputTest:: init input" << std::endl;
|
||||
BOOST_LOG(tests) << "MoveInputTest:: init input";
|
||||
|
||||
std::cout << "MoveInputTest:: get current mouse loc" << std::endl;
|
||||
BOOST_LOG(tests) << "MoveInputTest:: get current mouse loc";
|
||||
auto old_loc = platf::get_mouse_loc(input);
|
||||
std::cout << "MoveInputTest:: got current mouse loc: " << old_loc << std::endl;
|
||||
BOOST_LOG(tests) << "MoveInputTest:: got current mouse loc: " << old_loc;
|
||||
|
||||
std::cout << "MoveInputTest:: move: " << mouse_delta << std::endl;
|
||||
BOOST_LOG(tests) << "MoveInputTest:: move: " << mouse_delta;
|
||||
platf::move_mouse(input, mouse_delta.x, mouse_delta.y);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
std::cout << "MoveInputTest:: moved: " << mouse_delta << std::endl;
|
||||
BOOST_LOG(tests) << "MoveInputTest:: moved: " << mouse_delta;
|
||||
|
||||
std::cout << "MoveInputTest:: get updated mouse loc" << std::endl;
|
||||
BOOST_LOG(tests) << "MoveInputTest:: get updated mouse loc";
|
||||
auto new_loc = platf::get_mouse_loc(input);
|
||||
std::cout << "MoveInputTest:: got updated mouse loc: " << new_loc << std::endl;
|
||||
BOOST_LOG(tests) << "MoveInputTest:: got updated mouse loc: " << new_loc;
|
||||
|
||||
bool has_input_moved = old_loc.x != new_loc.x && old_loc.y != new_loc.y;
|
||||
|
||||
if (!has_input_moved) {
|
||||
std::cout << "MoveInputTest:: haven't moved" << std::endl;
|
||||
BOOST_LOG(tests) << "MoveInputTest:: haven't moved";
|
||||
}
|
||||
else {
|
||||
std::cout << "MoveInputTest:: moved" << std::endl;
|
||||
BOOST_LOG(tests) << "MoveInputTest:: moved";
|
||||
}
|
||||
|
||||
EXPECT_TRUE(has_input_moved);
|
||||
@@ -77,14 +72,14 @@ TEST_P(MouseHIDTest, MoveInputTest) {
|
||||
|
||||
TEST_P(MouseHIDTest, AbsMoveInputTest) {
|
||||
util::point_t mouse_pos = GetParam();
|
||||
std::cout << "AbsMoveInputTest:: got param: " << mouse_pos << std::endl;
|
||||
BOOST_LOG(tests) << "AbsMoveInputTest:: got param: " << mouse_pos;
|
||||
|
||||
platf::input_t input = platf::input();
|
||||
std::cout << "AbsMoveInputTest:: init input" << std::endl;
|
||||
BOOST_LOG(tests) << "AbsMoveInputTest:: init input";
|
||||
|
||||
std::cout << "AbsMoveInputTest:: get current mouse loc" << std::endl;
|
||||
BOOST_LOG(tests) << "AbsMoveInputTest:: get current mouse loc";
|
||||
auto old_loc = platf::get_mouse_loc(input);
|
||||
std::cout << "AbsMoveInputTest:: got current mouse loc: " << old_loc << std::endl;
|
||||
BOOST_LOG(tests) << "AbsMoveInputTest:: got current mouse loc: " << old_loc;
|
||||
|
||||
#ifdef _WIN32
|
||||
platf::touch_port_t abs_port {
|
||||
@@ -99,22 +94,22 @@ TEST_P(MouseHIDTest, AbsMoveInputTest) {
|
||||
#else
|
||||
platf::touch_port_t abs_port {};
|
||||
#endif
|
||||
std::cout << "AbsMoveInputTest:: move: " << mouse_pos << std::endl;
|
||||
BOOST_LOG(tests) << "AbsMoveInputTest:: move: " << mouse_pos;
|
||||
platf::abs_mouse(input, abs_port, mouse_pos.x, mouse_pos.y);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
std::cout << "AbsMoveInputTest:: moved: " << mouse_pos << std::endl;
|
||||
BOOST_LOG(tests) << "AbsMoveInputTest:: moved: " << mouse_pos;
|
||||
|
||||
std::cout << "AbsMoveInputTest:: get updated mouse loc" << std::endl;
|
||||
BOOST_LOG(tests) << "AbsMoveInputTest:: get updated mouse loc";
|
||||
auto new_loc = platf::get_mouse_loc(input);
|
||||
std::cout << "AbsMoveInputTest:: got updated mouse loc: " << new_loc << std::endl;
|
||||
BOOST_LOG(tests) << "AbsMoveInputTest:: got updated mouse loc: " << new_loc;
|
||||
|
||||
bool has_input_moved = old_loc.x != new_loc.x || old_loc.y != new_loc.y;
|
||||
|
||||
if (!has_input_moved) {
|
||||
std::cout << "AbsMoveInputTest:: haven't moved" << std::endl;
|
||||
BOOST_LOG(tests) << "AbsMoveInputTest:: haven't moved";
|
||||
}
|
||||
else {
|
||||
std::cout << "AbsMoveInputTest:: moved" << std::endl;
|
||||
BOOST_LOG(tests) << "AbsMoveInputTest:: moved";
|
||||
}
|
||||
|
||||
EXPECT_TRUE(has_input_moved);
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
* @file tests/unit/test_rswrapper.cpp
|
||||
* @brief Test src/rswrapper.*
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
#include <src/rswrapper.h>
|
||||
}
|
||||
|
||||
#include <tests/conftest.cpp>
|
||||
#include "../tests_common.h"
|
||||
|
||||
TEST(ReedSolomonWrapperTests, InitTest) {
|
||||
reed_solomon_init();
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace stream {
|
||||
concat_and_insert(uint64_t insert_size, uint64_t slice_size, const std::string_view &data1, const std::string_view &data2);
|
||||
}
|
||||
|
||||
#include <tests/conftest.cpp>
|
||||
#include "../tests_common.h"
|
||||
|
||||
TEST(ConcatAndInsertTests, ConcatNoInsertionTest) {
|
||||
char b1[] = { 'a', 'b' };
|
||||
|
||||
@@ -4,60 +4,45 @@
|
||||
*/
|
||||
#include <src/video.h>
|
||||
|
||||
#include <tests/conftest.cpp>
|
||||
#include "../tests_common.h"
|
||||
|
||||
class EncoderTest: public virtual BaseTest, public PlatformInitBase, public ::testing::WithParamInterface<std::tuple<std::basic_string_view<char>, video::encoder_t *>> {
|
||||
protected:
|
||||
struct EncoderTest: PlatformTestSuite, testing::WithParamInterface<video::encoder_t *> {
|
||||
void
|
||||
SetUp() override {
|
||||
BaseTest::SetUp();
|
||||
PlatformInitBase::SetUp();
|
||||
|
||||
std::string_view p_name = std::get<0>(GetParam());
|
||||
std::cout << "EncoderTest(" << p_name << "):: starting Fixture SetUp" << std::endl;
|
||||
|
||||
std::cout << "EncoderTest(" << p_name << "):: validating encoder" << std::endl;
|
||||
video::encoder_t *encoder = std::get<1>(GetParam());
|
||||
bool isEncoderValid;
|
||||
isEncoderValid = video::validate_encoder(*encoder, false);
|
||||
|
||||
if (!isEncoderValid) {
|
||||
// if encoder is software fail, otherwise skip
|
||||
if (encoder == &video::software && std::string(TESTS_SOFTWARE_ENCODER_UNAVAILABLE) == "fail") {
|
||||
FAIL() << "EncoderTest(" << p_name << "):: software encoder not available";
|
||||
auto &encoder = *GetParam();
|
||||
if (!video::validate_encoder(encoder, false)) {
|
||||
// Encoder failed validation,
|
||||
// if it's software - fail (unless overriden with compile definition), otherwise skip
|
||||
if (encoder.name == "software" && std::string(TESTS_SOFTWARE_ENCODER_UNAVAILABLE) == "fail") {
|
||||
FAIL() << "Software encoder not available";
|
||||
}
|
||||
else {
|
||||
GTEST_SKIP_((std::string("EncoderTest(") + std::string(p_name) + "):: encoder not available").c_str());
|
||||
GTEST_SKIP() << "Encoder not available";
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cout << "EncoderTest(" << p_name << "):: encoder available" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TearDown() override {
|
||||
PlatformInitBase::TearDown();
|
||||
BaseTest::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
EncoderVariants,
|
||||
EncoderTest,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
#if !defined(__APPLE__)
|
||||
std::make_tuple(video::nvenc.name, &video::nvenc),
|
||||
&video::nvenc,
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
std::make_tuple(video::amdvce.name, &video::amdvce), std::make_tuple(video::quicksync.name, &video::quicksync),
|
||||
&video::amdvce,
|
||||
&video::quicksync,
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
std::make_tuple(video::vaapi.name, &video::vaapi),
|
||||
&video::vaapi,
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
std::make_tuple(video::videotoolbox.name, &video::videotoolbox),
|
||||
&video::videotoolbox,
|
||||
#endif
|
||||
std::make_tuple(video::software.name, &video::software)));
|
||||
&video::software),
|
||||
[](const auto &info) { return std::string(info.param->name); });
|
||||
|
||||
TEST_P(EncoderTest, ValidateEncoder) {
|
||||
// todo:: test something besides fixture setup
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user