test/src/processing/processing_subtask_queue_test.cpp
TEST_F(ProcessingSubTaskQueueTest, AddUnexpectedResult)
{
    std::vector<SGProcessing::SubTaskQueue> queueSnapshotSet1;

    auto pubs1 = std::make_shared<sgns::ipfs_pubsub::GossipPubSub>();;
    pubs1->Start(40001, {});


    ProcessingCore::SubTaskList subTasks;
    {
        auto subtask = std::make_unique<SGProcessing::SubTask>();
        subtask->set_results_channel("RESULT_CHANNEL_1");
        subTasks.push_back(std::move(subtask));
    }

    {
        auto subtask = std::make_unique<SGProcessing::SubTask>();
        subtask->set_results_channel("RESULT_CHANNEL_2");
        subTasks.push_back(std::move(subtask));
    }

    auto pubs1Channel = std::make_shared<sgns::ipfs_pubsub::GossipPubSubTopic>(pubs1, "PROCESSING_CHANNEL_ID");
    auto nodeId1 = pubs1->GetLocalAddress();

    ProcessingSubTaskQueue queue1(pubs1Channel, pubs1->GetAsioContext(), nodeId1);

    // Create the queue on node1
    queue1.CreateQueue(subTasks);

    SGProcessing::SubTaskResult subTaskResult;
    ASSERT_TRUE(queue1.AddSubTaskResult("RESULT_CHANNEL_1", subTaskResult));
    ASSERT_FALSE(queue1.AddSubTaskResult("RESULT_CHANNEL_UNKNOWN", subTaskResult));

    pubs1->Stop();
}
/**
 * @given A subtask queue
 * @when New results added
 * @then Queue ignores results that are not relevant to subtasks located in the queue.
 */
@given A subtask queue
@when New results added
@then Queue ignores results that are not relevant to subtasks located in the queue.
@given A subtask queue @when New results added @then Queue ignores results that are not relevant to subtasks located in the queue .
TEST_F(ProcessingSubTaskQueueTest, AddUnexpectedResult)
{
    std::vector<SGProcessing::SubTaskQueue> queueSnapshotSet1;
    auto pubs1 = std::make_shared<sgns::ipfs_pubsub::GossipPubSub>();;
    pubs1->Start(40001, {});
    ProcessingCore::SubTaskList subTasks;
    {
        auto subtask = std::make_unique<SGProcessing::SubTask>();
        subtask->set_results_channel("RESULT_CHANNEL_1");
        subTasks.push_back(std::move(subtask));
    }
    {
        auto subtask = std::make_unique<SGProcessing::SubTask>();
        subtask->set_results_channel("RESULT_CHANNEL_2");
        subTasks.push_back(std::move(subtask));
    }
    auto pubs1Channel = std::make_shared<sgns::ipfs_pubsub::GossipPubSubTopic>(pubs1, "PROCESSING_CHANNEL_ID");
    auto nodeId1 = pubs1->GetLocalAddress();
    ProcessingSubTaskQueue queue1(pubs1Channel, pubs1->GetAsioContext(), nodeId1);
    queue1.CreateQueue(subTasks);
    SGProcessing::SubTaskResult subTaskResult;
    ASSERT_TRUE(queue1.AddSubTaskResult("RESULT_CHANNEL_1", subTaskResult));
    ASSERT_FALSE(queue1.AddSubTaskResult("RESULT_CHANNEL_UNKNOWN", subTaskResult));
    pubs1->Stop();
}
TEST_F ( ProcessingSubTaskQueueTest , AddUnexpectedResult ) { std :: vector < SGProcessing :: SubTaskQueue > queueSnapshotSet1 ; auto pubs1 = std :: make_shared < sgns :: ipfs_pubsub :: GossipPubSub > ( ) ; ; pubs1 -> Start ( 40001 , { } ) ; ProcessingCore :: SubTaskList subTasks ; { auto subtask = std :: make_unique < SGProcessing :: SubTask > ( ) ; subtask -> set_results_channel ( " " ) ; subTasks . push_back ( std :: move ( subtask ) ) ; } { auto subtask = std :: make_unique < SGProcessing :: SubTask > ( ) ; subtask -> set_results_channel ( " " ) ; subTasks . push_back ( std :: move ( subtask ) ) ; } auto pubs1Channel = std :: make_shared < sgns :: ipfs_pubsub :: GossipPubSubTopic > ( pubs1 , " " ) ; auto nodeId1 = pubs1 -> GetLocalAddress ( ) ; ProcessingSubTaskQueue queue1 ( pubs1Channel , pubs1 -> GetAsioContext ( ) , nodeId1 ) ; queue1 . CreateQueue ( subTasks ) ; SGProcessing :: SubTaskResult subTaskResult ; ASSERT_TRUE ( queue1 . AddSubTaskResult ( " " , subTaskResult ) ) ; ASSERT_FALSE ( queue1 . AddSubTaskResult ( " " , subTaskResult ) ) ; pubs1 -> Stop ( ) ; }
@given A subtask queue
 @when New results added
 @then Queue ignores results that are not relevant to subtasks located in the queue.
@given A subtask queue @when New results added @then Queue ignores results that are not relevant to subtasks located in the queue .
// Create the queue on node1