Skip to content

Technical overview

Typical Workflow

Below are schematic diagrams illustrating the main functionalities:

1. Splitting a Mock File

+-------------------+
|   Large Mock File |
+-------------------+
           |
           v
+-------------------+   +-------------------+   +-------------------+
|  Split Part 1     |   |  Split Part 2     |   |  Split Part ...   |
+-------------------+   +-------------------+   +-------------------+

2. Merging Mock Files

+-------------------+   +-------------------+   +-------------------+
|  Mock File 1      |   |  Mock File 2      |   |  Mock File ...    |
+-------------------+   +-------------------+   +-------------------+
           |                   |                        |
           +-------------------+------------------------+
                               |
                               v
                    +-----------------------+
                    |   Merged Mock File    |
                    +-----------------------+

3. Restoring a Corrupted Mock File

+------------------------+
| Corrupted Mock File    |
+------------------------+
           |
           v
+------------------------+
| Restored Mock File     |
+------------------------+

Here is a small example of how to use phoenix_mock.

4. Example: Using PhoenixMock in C++

Below is a minimal example showing how to use the core functions to split and concatenate mock messages:

#include "phoenix_mock.h"
#include <vector>
#include <iostream>

int main() {
    // Example input: a vector of 3 mock messages
    std::vector<std::vector<char>> messages = {
        {'H', 'e', 'l', 'l', 'o'},
        {'W', 'o', 'r', 'l', 'd'},
        {'!'}
    };

    // Split: extract the first 2 messages
    std::vector<std::vector<char>> splitMessages;
    splitVecMessage(splitMessages, messages, 0, 2);

    // Concatenate: add the split messages to another vector
    std::vector<std::vector<char>> outputMessages;
    concatenateVecMessage(outputMessages, splitMessages);

    // Print the result
    for(const auto& msg : outputMessages) {
        std::cout << std::string(msg.begin(), msg.end()) << std::endl;
    }
    return 0;
}

This will output:

Hello
World

PhoenixMock is part of the PHOENIX_LIBS2 project.