Related refactoring to updated of ThrottleList to use new Scheduler.

This commit is contained in:
Jari Sundell
2025-05-12 10:38:07 +02:00
committed by GitHub
parent 6d888c008d
commit 9ff373fe58
33 changed files with 1005 additions and 230 deletions
-20
View File
@@ -1,20 +0,0 @@
#include <cppunit/extensions/HelperMacros.h>
class CommandDynamicTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(CommandDynamicTest);
CPPUNIT_TEST(test_basics);
CPPUNIT_TEST(test_get_set);
CPPUNIT_TEST(test_old_style);
CPPUNIT_TEST_SUITE_END();
public:
void setUp();
void tearDown() {}
void test_basics();
void test_get_set();
void test_old_style();
private:
};
@@ -1,22 +1,21 @@
#include "config.h"
#include <iostream>
#include "test/src/test_command_dynamic.h"
#include "command_dynamic_test.h"
#include "helpers/assert.h"
#include "rpc/parse_commands.h"
#include "control.h"
#include "globals.h"
#include "rpc/parse_commands.h"
CPPUNIT_TEST_SUITE_REGISTRATION(CommandDynamicTest);
CPPUNIT_TEST_SUITE_REGISTRATION(TestCommandDynamic);
void initialize_command_dynamic();
void initialize_command_ui();
void
CommandDynamicTest::setUp() {
TestCommandDynamic::setUp() {
m_test_main_thread = TestMainThread::create();
m_test_main_thread->init_thread();
if (rpc::commands.find("method.insert") == rpc::commands.end()) {
setlocale(LC_ALL, "");
// cachedTime = rak::timer::current();
@@ -28,13 +27,18 @@ CommandDynamicTest::setUp() {
}
void
CommandDynamicTest::test_basics() {
TestCommandDynamic::tearDown() {
m_test_main_thread.reset();
}
void
TestCommandDynamic::test_basics() {
rpc::commands.call_command("method.insert.value", rpc::create_object_list("test_basics.1", int64_t(1)));
CPPUNIT_ASSERT(rpc::commands.call_command("test_basics.1", torrent::Object()).as_value() == 1);
}
void
CommandDynamicTest::test_get_set() {
TestCommandDynamic::test_get_set() {
rpc::commands.call_command("method.insert.simple", rpc::create_object_list("test_get_set.1", "cat=1"));
CPPUNIT_ASSERT(rpc::commands.call_command("test_get_set.1", torrent::Object()).as_string() == "1");
CPPUNIT_ASSERT(rpc::commands.call_command("method.get", "test_get_set.1").as_string() == "cat=1");
@@ -44,7 +48,7 @@ CommandDynamicTest::test_get_set() {
}
void
CommandDynamicTest::test_old_style() {
TestCommandDynamic::test_old_style() {
rpc::commands.call_command("method.insert", rpc::create_object_list("test_old_style.1", "value", int64_t(1)));
CPPUNIT_ASSERT(rpc::commands.call_command("test_old_style.1", torrent::Object()).as_value() == 1);
+24
View File
@@ -0,0 +1,24 @@
#include "test/helpers/test_fixture.h"
#include "test/helpers/test_main_thread.h"
class TestCommandDynamic : public test_fixture {
CPPUNIT_TEST_SUITE(TestCommandDynamic);
CPPUNIT_TEST(test_basics);
CPPUNIT_TEST(test_get_set);
CPPUNIT_TEST(test_old_style);
CPPUNIT_TEST_SUITE_END();
public:
void setUp();
void tearDown();
void test_basics();
void test_get_set();
void test_old_style();
private:
std::unique_ptr<TestMainThread> m_test_main_thread;
};