Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1a3e15b
initial commit
shawnkchan Nov 24, 2025
5abe26f
feat: add header file for order_graph_validator
shawnkchan Nov 24, 2025
7ddb89c
feat: add unit tests for order_graph_validator
shawnkchan Nov 24, 2025
803a323
fix: use vda5050_types
shawnkchan Nov 24, 2025
12fd3a1
fix: use vda5050_types in tests
shawnkchan Nov 24, 2025
cae3c3b
chore: add package and tests to cmake
shawnkchan Nov 24, 2025
becce38
fix: fix linting errors
shawnkchan Nov 24, 2025
2e9ca5b
refactor: place order_graph_validator in order directort
shawnkchan Nov 28, 2025
ef4bccc
refactor: place order_graph_validator in client directory
shawnkchan Nov 28, 2025
135c0c3
refactor: move order_graph_manager into client/order directory
shawnkchan Nov 28, 2025
6179f8c
refactor: move order_graph_validator into vda5050_core::client::order…
shawnkchan Nov 28, 2025
0c8a8f0
refactor: update order_graph_validator to use VDA5050 logging macros …
shawnkchan Nov 28, 2025
a771210
feat: crete validation_result struct for more detailed error reporting
shawnkchan Nov 28, 2025
6061e79
fix: reimplement is_in_traversal_order function
shawnkchan Nov 28, 2025
acb2a96
refactor: update tests according to new order_graph_validator
shawnkchan Nov 28, 2025
2d69c21
feat: add equality and inequality operators for testing purposes
shawnkchan Nov 28, 2025
5647d38
chore: update CMakeLists
shawnkchan Nov 28, 2025
77aee79
style: apply clang-format
shawnkchan Nov 30, 2025
b8ac8d5
style: apply clang-format to order_graph_validator test
shawnkchan Nov 30, 2025
29e1e43
chore: disable if else style check for cpplint during testing
shawnkchan Dec 1, 2025
fd04ac0
style: add space before comment
shawnkchan Dec 1, 2025
58be0ae
refactor: remove equality and inequality checks as tests do not requi…
shawnkchan Dec 1, 2025
d5a6b38
test: make test cases more detailed
shawnkchan Dec 1, 2025
42d6a64
refactor: change Error Level of graph validation errors to WARNING in…
shawnkchan Dec 1, 2025
ce90e6f
feat: add function checking for valid sequenceIds
shawnkchan Dec 3, 2025
fb2f40d
feat: create graph_element struct for easier management of nodes and …
shawnkchan Dec 3, 2025
553ecdc
refactor: refactor order_graph_manager to do additional checks for gr…
shawnkchan Dec 3, 2025
bce7af2
chore: remove line to find gtest package in CMakeLists
shawnkchan Dec 4, 2025
5cc4b70
chore: make classes explicit
shawnkchan Dec 4, 2025
04c011f
chore: move fmt header to top of file
shawnkchan Dec 4, 2025
a451f90
chore: temporary change to use "" instead of <> for vda5050_types to …
shawnkchan Dec 5, 2025
8eb611c
fix: change include back to use <> for vda5050_types
shawnkchan Dec 5, 2025
e009b26
feat: update test cases
shawnkchan Dec 5, 2025
8e5f90f
chore: update description of in_traversal_order()
shawnkchan Dec 5, 2025
c7faa4b
refactor: revised graph validator and test cases
Johnarman1398 Dec 13, 2025
1b3d073
chore: lint
Johnarman1398 Dec 13, 2025
ee9200c
chore: lint
Johnarman1398 Dec 13, 2025
1f87a73
chore: merged changes from develop
Johnarman1398 Dec 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion vda5050_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ target_include_directories(logger

add_library(client
src/vda5050_core/client/order/order_graph_validator.cpp
src/vda5050_core/client/order/graph_element.cpp
)
target_link_libraries(client
PRIVATE
Expand Down
61 changes: 0 additions & 61 deletions vda5050_core/include/vda5050_core/client/order/graph_element.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,17 @@
#include <vector>

#include <vda5050_types/order.hpp>
#include "vda5050_core/client/order/graph_element.hpp"
#include "vda5050_core/client/order/validation_result.hpp"

namespace vda5050_core {
namespace client {
namespace order {

/// \brief Utility class with functions to perform validity checks on the graph
/// contained in a VDA5050 Order message
class OrderGraphValidator
{
public:
explicit OrderGraphValidator(const vda5050_types::Order& order);
OrderGraphValidator() = delete;

/// \brief Checks that the nodes and edges in a VDA5050 Order form a valid
/// graph according to the VDA5050 specification sheet.
Expand All @@ -44,56 +42,15 @@ class OrderGraphValidator
/// and any errors if it is not.
///
/// \return True if nodes and edges create a valid graph, false otherwise
ValidationResult is_valid_graph();
static ValidationResult is_valid_graph(
const vda5050_types::Order& order) noexcept(false);

private:
const vda5050_types::Order& order_;

std::vector<GraphElement> graph_;

/// \brief Helper function to populate graph_ in the constructor.
void create_graph();

/// \brief Checks that the nodes and edges contained in a VDA5050 Order are
/// arranged in contiguous and ascending sequenceId order
///
/// \param order The order to be checked.
/// \return ValidationResult containing if the order being checked is valid,
/// and any errors if it is not.
///
/// \return True if nodes and edges are arranged according to their
/// sequenceId, false otherwise
ValidationResult is_in_traversal_order();

/// \brief Checks that after the first unreleased node or edge, the subsequent
/// nodes and edges are not released.
///
/// \return ValidationResult containing if the order being checked is valid,
/// and any errors if it is not.
ValidationResult has_only_one_base();

/// \brief Checks that all node sequenceIds are always even, and that all edge
/// sequenceIds are always odd.
///
/// \param order The order to be checked.
///
/// \return ValidationResult containing if the order being checked is valid,
/// and any errors if it is not.
ValidationResult has_valid_sequence_ids();

/// \brief Checks that startNodeId and endNodeId of all edges in a VDA5050
/// Order match with its the start and end nodeIds
///
/// \param order The order to be checked.
/// \return ValidationResult containing if the order being checked is valid,
/// and any errors if it is not.
///
/// \return True if all edges' startNodeId and endNodId match, false otherwise
ValidationResult has_valid_edges();
static ValidationResult is_valid_order_update(
const vda5050_types::Order& base_order,
const vda5050_types::Order& next_order) noexcept(false);
};

} // namespace order
} // namespace client
} // namespace vda5050_core

#endif // VDA5050_CORE__CLIENT__ORDER__ORDER_GRAPH_VALIDATOR_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,25 @@
#include <vda5050_types/error.hpp>

namespace vda5050_core {
namespace client {
namespace order {

/// \brief Struct that details the validity of an order
struct ValidationResult
{
/// \brief True if an order is valid, false otherwise
bool valid;

/// \brief A vector of error(s) that resulted in an invalid order. Empty if
/// order is valid.
std::vector<vda5050_types::Error> errors;

/// \brief Allows use in boolean contexts
///
/// \return True if the order is valid, false otherwise.
explicit operator bool() const
{
return errors.empty();
}
};

} // namespace order
} // namespace client
} // namespace vda5050_core

#endif // VDA5050_CORE__CLIENT__ORDER__VALIDATION_RESULT_HPP_
51 changes: 0 additions & 51 deletions vda5050_core/src/vda5050_core/client/order/graph_element.cpp

This file was deleted.

Loading